Dining Philosophers Simulator

  1. Download the simulator from link: http://siber.cankaya.edu.tr/OperatingSystems/week7l/StarvingPhilosophers.tar.gz StarvingPhilosophers.tar.gz.
  2. Unpack the simulator with the following command:
    tar zxvf StarvingPhilosophers.tar.gz
    
  3. Run the simulator with the following command:
    cd StarvingPhilosophers
    chmod +x runsp
    ./runsp
    
    Figure 1: Dining Philosophers Simulator
    \includegraphics[width=100mm]{figures/starving-philosophers-simulator.eps}
  4. First of all, read the sp_doc.html file carefully. This file contains detailed information about running and modifying the parameters of the simulation.
  5. Each time you want to modify simulation parameters such as number of philosophers or whether starving is enabled or not, you have to edit the spconfig file and restart the simulator. The contents of spconfig file look like this:
    user Unknown User
    quiet
    logfn mylog2.html
    number 5
    seed 12345 65432
    starving off
    animate on
    classification signal and continue
    queueing fifo
    eatingdist constant 100
    thinkingdist constant 100
    starvingdist constant 900
    thinkingdist1 constant 3
    thinkingdistvalue1 2
    eatingdist1 constant 2
    thinkingdist2 constant 1
    eatingdist2 constant 4
    eatingdistvalue2 2
    thinkingdist3 constant 2
    eatingdist3 constant 4
    thinkingdist4 constant 1
    eatingdist4 constant 5
    starvingdistvalue4 900
    
  6. Each line in this file hold various parameters related to the simulation.
  7. After starting the simulator, click on the ``Run Until Starvation'' button. This will start the simulation.
  8. Animated sequence of simulation will start and continue until simulation has been aborted or starving has occured.
  9. You may draw a gannt chart for displaying how long each philosopher spent their time for thinking, eating or as hungry by clicking on the ``Gannt Chart'' button.
  10. For different sample runs, have a look at demos directory.
  11. Exercise: Modify the simulation parameters to create a deadlock (starvation). You are free to modify any parameters you like to, but you should explain your method.
Cem Ozdogan 2010-04-10