Concurrency vs Parallelism, Concurrent Programming vs Parallel Programming

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.

Comments:

Thanks for this clear and succinct explanation!

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

thanks for clearing my mind of such doubts...

Posted by maria on October 17, 2008 at 07:10 PM 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 03: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 07:13 AM PST #

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

Posted by 勇敢的鸵鸟 on January 29, 2009 at 10:50 PM 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 03, 2009 at 10:47 PM 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 26, 2009 at 07:48 PM PDT #

Many thanks for elaboarting the difference between concurrency and parallelism in such simpeler, but informative, way!

Posted by eabdibr on April 03, 2010 at 09:03 PM PDT #

dfgf

Posted by guest on February 07, 2011 at 08:24 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

yuanlin

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today