|
|
Historically, most programs are examples of ``sequential programming''. That is, they consist of a series of operations that are carried out one at a time. With ``concurrent programming'' the programmer can specify sets of instructions that potentially can be executed in parallel and still provide correct results.
The advantages of this style of programming are:
Programs are often written to emulate or respond to events in the real world. In the real world, concurrency is common and purely sequential events are the exception. Modeling such behavior is facilitated if the programming environment supports the notion of concurrency.
If multiple processors are available, the program might be executed in less real time (than sequential execution) if more than one processor is working simultaneously. This is called ``true concurrency''.
Even on uniprocessor machines, there may be some performance gain from designing greater concurrency into the program. While one activity is blocked, others might still be executing.
Thus, there is an advantage to concurrent programming even if the resources (processors) are not available to provide ``true concurrency'' and the application is only ``logically concurrent''.