Parallelism vs Concurrency

Parallelism - two things are happening at the same time. Parallel computation -> two computations are being done at the same time -> two cores are performing two tasks at the same time. If two tasks run parallelly, and each of them takes 1s to complete - they will be done in less than 2 seconds.

Concurrency - If two tasks are concurrent, it means they start and do their work and end in overlapping periods of time. In case of a single core processor, we can still run many tasks. So what happens is OS quickly switches between tasks, it seems to be executing tasks parallelly, but it is just fast switching between tasks.

All concurrent tasks are parallel, but not the other way round.

Last updated