Synchronous operations as first-class values

J. H. Reppy
1988 SIGPLAN notices  
Synchronous message passing via channels is an interprocess communication (IPC) mechanism found in several concurrent languages, such as CSP, occam, and Amber. Such languages provide a powerful selective I/O operation, which plays a vital role in managing communication with multiple processes. Because the channel IPC mechanism is "operation-oriented," only procedural abstraction techniques can be used in structuring the communication/synchronization aspects of a system. This has the unfortunate
more » ... has the unfortunate effect of restricting the use of selective I/O. which in turn limits the communication structure. We propose a new, "value-oriented" approach to channel-based synchronization. We make synchronous operations first-class values, called events, in much the same way that functions are firstclass values in functional programming languages. Our approach allows the use of data abstraction techniques for structuring IPC. We have incorporated events into PML, a concurrent functional programming language, and have implemented run-time support for them as part of the Pegasus system. I. Introduction A common mechanism of interprocess communication (IPC) and synchronization in concurrent programming languages is synchronous message passing via channels (channel IPC). First exhibited in CSPrHoaE781, this mechanism has also been used in occam IINMos831, Amber[Cardelli*61 and the Pegasus system[RG8B. A channel IPC mechanism typically provides three synchronous operations: send, to send a message on a channel; accepr, to read a message from a channel; and select, to allow non-deterministic communication on multiple channels. These channel IPC operations ate synchronous; for example, a process sending a message on a channel will block until another process executes a marching' accept operation on the same channel (and vice versa). The select operation allows a process to synchronize on the matching of one of a group of send and accept operations. If two, or more, of the group are immediately matchable, then one is selected non-deterministically, otherwise the first operation matched is selected. Associated with each operation is an optional guard, which must be true if the operation is to be matched, and an action that is executed if the operation is selected. The select operation provides tremendous flexibility in allowing processes to manage communication with multiple processes. Unfortunately, there is no language structure to aid in the management of complex communication with a single process. One can use procedural abstraction to structure complex protocols, but the resulting abstraction cannot be used with select. In this paper, we present a channel IPC mechanism that uses t Consultant. Author's current address:
doi:10.1145/960116.54015 fatcat:ueohhdzrtvhjzak4j7vgr7s4f4