Feature | Concurrency | Parallelism |
---|---|---|
Definition | Managing multiple tasks | Executing multiple tasks simultaneously |
Hardware Requirement | Single processor | Multiple processors/cores |
Goal | Responsiveness, handling multiple requests | Performance, reducing execution time |
Feature | Concurrency | Parallelism |
---|---|---|
Definition | Managing multiple tasks | Executing multiple tasks simultaneously |
Hardware Requirement | Single processor | Multiple processors/cores |
Goal | Responsiveness, handling multiple requests | Performance, reducing execution time |
Feature | Thread | Process |
---|---|---|
Memory Space | Shared | Independent |
Resource Usage | Lightweight | Heavyweight |
Communication | Efficient, shared memory | Inter-process communication (IPC) |
Feature | Thread | Process |
---|---|---|
Memory Space | Shared | Independent |
Resource Usage | Lightweight | Heavyweight |
Communication | Efficient, shared memory | Inter-process communication (IPC) |
Primitive | Purpose | Mechanism |
---|---|---|
Mutex | Exclusive access | Lock/Unlock |
Semaphore | Controlled access | Counter |
Condition Variable | Waiting for condition | Wait/Signal |
Primitive | Purpose | Mechanism |
---|---|---|
Mutex | Exclusive access | Lock/Unlock |
Semaphore | Controlled access | Counter |
Condition Variable | Waiting for condition | Wait/Signal |
Data Structure | Concurrency Strategy | Use Case |
---|---|---|
Concurrent HashMap | Fine-grained locking | High-concurrency key-value storage |
Concurrent Queue | Lock-free algorithms or fine-grained locking | Asynchronous task processing |
Copy-on-Write Array | Copy on write | Read-heavy scenarios with infrequent updates |
Data Structure | Concurrency Strategy | Use Case |
---|---|---|
Concurrent HashMap | Fine-grained locking | High-concurrency key-value storage |
Concurrent Queue | Lock-free algorithms or fine-grained locking | Asynchronous task processing |
Copy-on-Write Array | Copy on write | Read-heavy scenarios with infrequent updates |
Feature | Synchronous Programming | Asynchronous Programming |
---|---|---|
Blocking | Yes | No |
Responsiveness | Lower | Higher |
Use Case | CPU-bound tasks | I/O-bound tasks |
Feature | Synchronous Programming | Asynchronous Programming |
---|---|---|
Blocking | Yes | No |
Responsiveness | Lower | Higher |
Use Case | CPU-bound tasks | I/O-bound tasks |