Send/Receive

Th Christopher
Memo home page

Memo Prog Tech

In languages derived from CSP (Hoare's "Communicating Sequential Processes") such as Occam, processes communicate synchronously through channel variables. A channel connects precisely two processes. One process writes to the channel and the other reads. Since the communication is synchronous, whichever process attempts to read or write first will be delayed until the other process attempts the other operation.

In Memo, a folder may be used as a channel and memos to contain the communications, but to make it synchronous, another folder must be used as a semaphore. Call the channel folder C and the semaphore folder S. Initially both are empty. Code for sending and receiving areas follows:

Sender Receiver
put memo containing the 
  communication into folder C
get an empty memo from
  folder S
get memo containing the
  communication from folder C
put an empty memo into folder S

CSP languages also permit an alternative read: a receiver can enable input from one of a set of channels. The analogous operation in Memo is memo_alt.


This page last updated 09/30/97