The Dining Philosophers problem was first described by Edsger W. Dijkstra in 1965. It is a model and universal method for testing and comparing theories on resource allocation. The problem consists of a finite set of processes which share a finite set of resources, each of which can be used by only one process at a time, thus leading to potential deadlock and lifelock situations. The example scenario includes three different component types, Philosopher, Fork and Observer. A configurable number of philosophers (processes) are sitting on a round table with a finite number of forks (resources). Philosophers perform actions - thinking, eating and sleeping. They do not need any resources in order to think or sleep, but they need two forks in order to eat, one for the left hand and one for the right hand. Therefore, before starting to eat, a philosopher tries to get the two forks, which are configured to be next to him. An observer will be notified by all philosophers in the case of an activity change, i.e. at the time a philosopher starts eating, starts thinking or starts sleeping. Furthermore, the critical state of getting hungry is notified to an observer as well.
The examples IDL3 specification originates from the OMG document ccm/01-05-05. The specification is to be found in the subdirectory PhilosophersIDL. The implementation structure of the example is determined in the CIDL specification in the same directory. The Fork is implemented separately in a dynamic library. The implementations for Observer and Philosopher are put together in another dynamic library. The client implementation creates an assembly and thus invokes the installation and instantiation of all the components described in the Component Assembly Descriptor philosophers.cad in the clients directory.
This example is a slightly altered version of the former one. It was implemented to be used at an OMG meeting to demonstrate interoperability between different container and component implementations.