Communicating sequential processes

\label{des/per:CSP} \parindex{sequential processes} The basic model of a distributed programming language is that of a group of sequential processes that run in parallel and communicate by message passing. By a sequential process we mean a process with a single thread of control. C.f.  [We87].

Processes

\parindex{processes} The prime example of a language supporting communicating sequential processes is CSP.  [Ho78]. In CSP we may create a fixed number of parallel processes by using a parallel operator. Each process consists of a name and a body, that is a sequence of statements. Communication between processes is achieved by using send and receive statements. As an example, consider the program [] [ p1 :: p2!3 || p2 :: p1?n ] where process p1 is about to execute the statement p2!3, sending the value 3 to process p2 and p2 is about to execute p1?n, to receive a value from p1 that is assigned to the (integer) variable n. The proposal in  [Ho78] also provides for pattern matching in communication. \parindex{guarded command} Also, a guarded command is offered, that allows to select a particular alternative dependent on the possibility of a communication. Due to its synchronous nature, communication in CSP is said to subsume synchronization mechanisms such as semaphores, events, conditional critical regions and monitors. C.f.  [AS83].

Channels

\parindex{channels} Occam is a language that embodies a number of the features of CSP.  [In84]. A noticeable difference with CSP is that communication statements do not address processes, but that instead communication takes place over channels. Occam is the machine language of the transputer. Transputers may be connected into a network. The language provides a mechanism for mapping symbolic channels to the actual hardware channels implementing the network. In contrast to CSP, Occam also provides facilities for mapping processes on processing units. \nop{ Despite the fact that Occam is a low level language, lacking data types, recursive procedures and modules, it is used in a number of applications.  [Jo85]. } \parindex{efficiency} \parindex{grain of parallelism} Perhaps the major advantage of such a language is that it is efficiently implementable, giving the programmer full control over the hardware resources. C.f.  [Ba89]. From the point of view of program design, however, the necessity of such control may be considered a disadvantage. From this perspective, languages with inherent parallelism seem more suitable. As alternatives to languages supporting the basic model we have: object oriented languages, that support concurrently executing active objects; functional languages, that allow parallel evaluation due to the absence of side-effects; and logic programming languages, that enable to work in parallel on parts of the and/or proof tree. \nop{ With the possible exception of the latter, these languages usually display a more fine grained parallelism. }