ConcurrencyAndParallelismAre
NotThe same thing. Two TasksT1AndT2Are concurrent if the order in which the two tasks are executed in time is not predetermined,
- T1May be executed and finished before
T2,
- T2May be executed and finished before
T1,
- T1AndT2May be executed simultaneously at the same instance of time (Parallelism ),
- T1AndT2May 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.
ConcurrencyIs often referred to as a property of a program, and is a concept more general
Parallelism.
Interestingly, weCannotSay the same thing
Concurrent ProgrammingAndParallel 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 between des
Topic like signal handling, while parallel programming into des topic like memory consistency model. The difference reflects the different orignal hardware and software background of the two programming practices.
[Original link: http://blogs.oracle.com/yuanlin/entry/concurrency_vs_parallelism_concurrent_programming]