back to API     back to index     back to guided tour index     prev     next  

The dining philosophers

The "dining philosophers" problem is a classical exercise in the teaching of concurrent programming. The goal is to avoid deadlocks.

We have provided an illustration of the solution using ProActive, where all the philosophers are active objects, as well as the table (controller) and the dinner frame (user interface).

 

1. start the philosophers application

with philosophers.sh or philosophers.bat

ProActive creates a new node and instantiates the active objects of the application : DinnerLayout, Table, and Philosopher

the GUI is started.

2. understand the color codes

Philosophers
philosophing
hungry, wants the fork !
eating
Forks
taken
free

 

3. test the autopilot mode

The application runs by itself without encountering a deadlock.

 

4. test the manual mode

Click on the philosophers' heads to switch their modes

Test that there are no deadlocks!

Test that you can starve one of the philosophers (i.e. the others alternate eating and thinking while one never eats!)

 

5. start the IC2D application

IC2D is a graphical environment for monitoring and steering of distributed and metacomputing applications.

- being in the autopilot mode, start the IC2D visualization application (using ic2d.sh or ic2d.bat)

 

the ic2d GUI is started. It is composed of 2 panels : the main panel and the events list panel

- acquire you current machine

menu monitoring - monitor new RMI host

It is possible to visualize the status of each active object (processing, waiting etc...), the communications between active objects, and the topology of the system (here all active objects are in the same node) :