An occam Model of Teig's XCHANs

Oyvind Teig, in [1], proposed a higher level channel construct (XCHAN) that attempts to reconcile those wedded to asynchronous message passing with the synchronous form in CSP.

Sending a message does not block the sender, but the message may not get sent: the sender receives a success/fail result on each send. The XCHAN provides a conventional feedback channel on which it signals when it is ready to take a message. Being ready means that it has space (if it is buffered) or a reading process has committed to take the message (if it is not buffered). Sending to a ready XCHAN always succeeds; sending to an XCHAN that is not ready always fails. The sender can always wait for the signal from the XCHAN (whilst ALTing on, and processing, other events) before sending.

We can model an XCHAN by a process in occam-pi. Buffered XCHANs are easy. Zero-buffered XCHANs are a little harder, because we need to maintain end-to-end synchronisation. However, occam-pi's extended input (??) and output (!!) primitives enable the process implementing the XCHAN to be hidden from its users. Unfortunately, extended outputs are not yet in the language (but their semantics can be simulated by making the receiving process read twice, ignoring the first which is just a signal whose taking must commit the reader to its second read).

The point is that higher level synchronisation mechanisms are usually not hard to implement in the low level CSP primitives offered by occam. Although not yet measured for XCHANs, it is likely that such simulation in occam will have competitive performance with direct implementation elsewhere.

The open-source (L-GPL) code for this occam-pi model of an XCHAN is here, with HTML documentation here. Slides from [2] are here.

  1. Øyvind Teig. XCHANs: Notes on a New Channel Type. In Communicating Process Architectures 2012, pages 155–170. Open Channel Publishing, August 2012.

  2. Peter Welch. An occam Model of XCHANs. In Communicating Process Architectures 2013, page 329, (Fringe Presentation). Open Channel Publishing, November 2013.

  3. Øyvind Teig. Selective Choice "Feathering" with XCHANs. In Communicating Process Architectures 2013, pages 205-216. Open Channel Publishing, November 2013.

An occam Model of XCHANs (last edited 2013-12-04 15:17:59 by phw)