Concurrency Vs Parallelism

Jatin Tayal
2 min readAug 4, 2023

--

For a long time, I had confusion 🤷🏻‍♂️ between concurrency and parallelism and often used them interchangeably but they are not the same thing. Although both of them are related to the idea of performing multiple tasks at the same time but there are some key differences between them.

🔗 Concurrency
Concurrency refers to the ability of a system to manage multiple tasks at the same time. It is achieved through task switching, where the system switches between tasks to give the illusion of simultaneous execution.

Some key points about concurrency:
1. Single core execution: Concurrency can be achieved on a single core processor through context switching where the processor rapidly switches between different tasks.
2. Task interleaving: Concurrency involves interleaving multiple tasks, allowing them to make progress concurrently.

Concurrency is commonly used in scenarios where different tasks need to be managed simultaneously such as in server applications or user interfaces.

🔗 Parallelism
Parallelism, on the other hand, involves the simultaneous execution of multiple tasks across multiple processing units. Its main focus is towards improving performance by dividing a large task into smaller subtasks that can be executed in parallel.

Some key points about parallelism:
1. Multiple processing units: Parallel execution requires multiple processing units, such as multiple cores.
2. Task decomposition: Parallelism requires breaking down a large task into smaller and independent subtasks that can be executed simultaneously.

Parallelism is commonly utilized in computationally intensive tasks such as data processing, scientific simulations, or rendering.

Conclusion
1. Concurrency focuses on managing multiple tasks concurrently, improving responsiveness and enabling multitasking within a single processing unit.
2. Parallelism, on the other hand, aims to divide and conquer a large task by executing its subtasks simultaneously across multiple processing units.

--

--