What is the difference between concurrency and parallelism?
Interview preparation resource from Gate Smashers.
Concurrency means multiple tasks make progress during overlapping periods, while parallelism means multiple tasks execute at the same instant on different processing units.
A single CPU core can support concurrency by rapidly interleaving tasks. Only one instruction stream may execute at a moment, but switching between tasks allows an application to remain responsive while other work waits for input or output.
Parallelism normally requires multiple cores, processors or execution units. It can reduce completion time when work can be divided into independent parts, but it also introduces coordination, synchronization and load-balancing costs.
Concurrency is possible even on one CPU because tasks can be interleaved, while parallelism requires simultaneous execution resources such as multiple cores. A concurrent design may become parallel when hardware permits, but it must still be correct when operations are only interleaved.
