Concurrency vs Parallelism | Simply Explained
Blog / Concurrency vs Parallelism | Simply Explained
So what is the difference between a concurrency and parallelism?TL;DR Summary Concurrency Concurrency is the ability of a system to handle multiple tasks at the same time by managing the execution of these tasks. They can be executed in an interleaved manner rather than simultaneously.Example: On a single-core processor, the operating system can switch between different programs (e.g., a text editor and a web browser), giving the appearance that both are running at the same time.Parallelism Parallelism on the other hand involves the simultaneous execution of multiple tasks, which actually run at the same time on multiple processors or cores. Parallelism requires hardware support in the form of multiple processing units.Example: On a multi-core processor, different cores can execute different tasks at the same time. Like applying a filter to a large image which is a CPU-bound task
- Concurrency is about dealing with lots of things at once but parallelism is about doing lots of things at once. ~ Rob Pike
Don't let one question ruin your next technical interview...