Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Concurrency vs Parallelism

  sonic0002        2013-08-07 23:42:33       29,210        0    

Concurrency and parallelism are two related concepts which deal with executing tasks "simultaneously". From 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.

These two definitions are too formal to be understood easily. On the Internet, there is one image which demonstrates the difference between these two in an easy way:

Concurrent and Parallel Programming

Much easier to understand,right? For concurrency, tasks can start, run and complete in overlapping the time periods, but they may not run at the same instant, when one task in a queue is running, another task in the other queue will wait. While for parallelism, two tasks can run at the same instant. Concurrency has states which means they know status of other tasks execution, while parallelism is stateless.

With concurrency, we want to improve the responsiveness of the application, with parallelism, we want to improve the utilization efficiency of processors, as the computing speed of a single CPU is driving to its limit, so we try to integrate more processors on a single CPU to distribute tasks among different processors.

To clear up this conflation, Rob Pike gave a talk at Heroku's Waza conference entitled Concurrency is not parallelism, below is the video recording. You can get more information from this video.

CONCURRENCY  THREAD  PARALLELISM 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.