Sunday, 9 June 2019

Multithreading | Concurrency vs. Parallelism


Both words concurrency and parallelism are often used in relation to multithreaded programs. But what exactly do concurrency and parallelism mean, and are they the same terms or what?

The short answer is "no". They are not the same terms, although they appear quite similar on the surface.




Concurrency

Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. For example, multitasking on a single-core machine.

A condition that exists when at least two threads are making progress. A more generalized form of parallelism that can include time-slicing as a form of virtual parallelism.

Parallelism

Parallelism is when tasks literally run at the same time, e.g., on a multicore processor.

A condition that arises when at least two threads are executing simultaneously.


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...