Wednesday, January 16, 2019

language agnostic - What is the difference between concurrency and parallelism?



What is the difference between concurrency and parallelism?




Examples are appreciated.


Answer



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.



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






Quoting Sun's Multithreaded Programming Guide:





  • Concurrency: 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: A condition that arises when at least two threads are executing simultaneously.



No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...