Concepts in Concurrent Programming

John H. Reppy · Cambridge University Press eBooks · 1999

Concurrent programming differs from sequential programming in several significant ways. Conceptually, we can view the execution of a concurrent program as an interleaving of the sequential execution of its constituent processes. Since there are many possible interleavings, the execution of a concurrent program is nondeterministic; i.e. , different interleavings may produce different results. In effect, a concurrent program defines a partial order on its actions, whereas a sequential program defines a total order. This nondeterminism is both the bane and boon of concurrent programming: on the one hand, it creates additional correctness problems, while on the other hand, it provides flexibility and a more natural program structure. As argued in Chapter 1, the choice of programming notation can help the programmer control the complexity of concurrency, while reaping its benefits. A concurrent language typically consists of a sequential core (or sub-language), extended with support for concurrency. The concurrency support can be divided into three different kinds of mechanism: • A mechanism for introducing independent sequential threads of control, called processes . The process creation mechanism can be either static , restricting the program to a fixed number of processes, or dynamic , allowing new processes to be created “on-the-fly.” • A mechanism for processes to communicate . Communication involves exchanging data, either through shared memory locations ( e.g. , variables) or by explicit message passing. • And a mechanism for processes to synchronize . Synchronization restricts the ordering of execution in otherwise independent threads, and is used to limit the program's nondeterminism where necessary.

Read the paper · More papers on PaperTik