Touch Dreams

Concurrency vs Parallelism, Concurrent Programming vs Parallel Programming

Sunday Jun 11, 2006

THIS BLOG HAS BEEN MOVED TO touchdreams.net/blog.

In the danger of hairsplitting, ...

Concurrency and parallelism are NOT the same thing. Two tasks T1 and T2 are concurrent if the order in which the two tasks are executed in time is not predetermined,

  • T1 may be executed and finished before T2,
  • T2 may be executed and finished before T1,
  • T1 and T2 may be executed simultaneously at the same instance of time (parallelism),
  • T1 and T2 may be executed alternatively,
  • ...

If two concurrent threads are scheduled by the OS to run on one single-core non-SMT non-CMP processor, you may get concurrency but not parallelism. Parallelism is possible on multi-core, multi-processor or distributed systems.

Concurrency is often referred to as a property of a program, and is a concept more general than parallelism.

Interestingly, we cannot say the same thing for concurrent programming and parallel programming. They are overlapped, but neither is the superset of the other. The difference comes from the sets of topics the two areas cover. For example, concurrent programming includes topic like signal handling, while parallel programming includes topic like memory consistency model. The difference reflects the different orignal hardware and software background of the two programming practices.

Update: More on Concurrency vs Parallelism THIS BLOG HAS BEEN MOVED TO touchdreams.net/blog.

[7] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg
Comments:

Thanks for this clear and succinct explanation!

Posted by David on May 06, 2008 at 07:12 AM PDT #

thanks for clearing my mind of such doubts...

Posted by maria on October 18, 2008 at 02:10 AM PDT #

Could someone explain why signal handling is related to concurrent but not parallel programming?
If concurrent programming is about developing a program that has the concurrency property, and parallel programming about developing a program with multiple tasks that can run in parallel, and concurrency subsumes parallelism, why concurrent programming is not a superset of parallel programming?

Posted by hzmonte on December 19, 2008 at 11:18 PM PST #

I posted another entry to address hzmonte's question.
http://blogs.sun.com/yuanlin/entry/more_on_concurrency_vs_parallelism

Posted by Yuan on December 22, 2008 at 03:13 PM PST #

[Trackback] 说实话在翻译POSA的时候,我不想用这两个词:并发、并行,而宁愿保留原文。但是对于一本讲分布式计算的书,如果我如此固执,里面会多出大量的英文——虽然现在已经是很多了。实际上,我在译文中也做了灵活的处理...

Posted by 勇敢的鸵鸟 on January 30, 2009 at 06:50 AM PST #

Which is more advantageous parallel programming or concurrent programming?
Is there any field where only parallel programming is used & not concurrent prog.?

Posted by Isha on February 04, 2009 at 06:47 AM PST #

Precisely explained, good job.
@Isha Parallel computing. Although it is linked with concurrency but we can also do computations in parallel to speed up things WITH the execution order predetermined.

Posted by Monis Iqbal on May 27, 2009 at 02:48 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed