The Singing Dining Philosophers

The following files contain binary executables and were compiled from occam sources using the KRoC 0.9beta compiler:

  1. sp-sparc-sunos4.gz - SPARC (SunOS)
    This should work on Solaris 2 from version 2.5 onwards.
  2. sp-alpha-osf1.gz - Alpha (OSF/1)

The program animates Dijkstra's classic Dining Philosophers using just the UNIX `stdout' text channel -- i.e. no graphics. Nevertheless, it is quite fun and shows what can be done. A user can interact with the system (to freeze the action, instruct the butler to vary the number of philosophers allowed into the dining room at the same time and to break philosophers' right arms for a while) -- instructions are given on screen. However, if you let all five into the dining room and they all manage to pick up one fork, they just carry on whinging for ever.

This was designed by a second year undergraduate at Kent. The system contains some 52 processes (42 to 47 simultaneously active), with 25 drawing on the screen via a single SHARED channel (protected by a SEMAPHORE).

The system uses parallelism as a powerful design construct. Its parallelism was never motivated by performance considerations -- if you check the load imposed on the UNIX system whilst running this code, you will see that it is minimal. For any who don't believe that parallelism simplifies design, the challenge is to reproduce the behaviour of this demonstration using just serial programming technniques -- any language!

The full sources for this occam program can be obtained by mailing me. Kent students, who have to do this for a programming exercise, should not apply.

Peter Welch,
5th. December, 1996