Moonic's notes


Thursday, October 20, 2005

Concurrency vs. Parallelism

Despite the fact that in some contexts the terms concurrency and parallelism are not distinguished, some important differences should be mentioned.
Concurrency in a programming language and parallelism in the underlying hardware are independent concepts. Hardware operations occur in parallel if they overlap in time. Operations in the text of a program are concurrent if they could, but need not be, executed in parallel. Operations that occur one after the other, ordered in time, are said to be sequential. We can have concurrency in a language without parallel hardware, and we can have parallel execution without concurrency in the language. Shortly, concurrency refers to the potential for parallelism.
The Sun’s 'Multithreaded Programming Guide for Solaris' provides good definitions. Parallelism is a condition that arises when at least two threads are executing simultaneously, while concurrency is a condition that exists when at least two threads are making progress. Therefore concurrency is a more generalized form of parallelism that can include time-slicing as a form of virtual parallelism.