Implemented a solution of the famous Dining Philosophers problem and one of its modified version. It deals with concurrency and synchronisation issues which are dealt with using mutex as well as counting semaphores
Q1) The traditional dining philosopher problem: each philosopher needs the 2 forks to their left and right
to eat their meal.
Q2) This version was modified: the table had 4 sauce bowls in the centre accesible to all the philosophers and 5 forks in the table as is usually done in this problem. The philosopher would need 1 fork
and 1 sauce bowl
to eat their meal. Note that in this part there is no deadlock.
Q3) This version was modified: the table had 4 bowls in the centre accesible to all the philosophers and 5 forks in the table as is usually done in this problem. The philosopher would need 2 forks to their left and right
and 1 sauce bowl
to eat their meal
- Keep all files in the same directory.
- Run the
make
command in the terminal. - Open the terminal and run either
./dp
or./dp3
according to your need - Run
make clean
to delete the output files and clean up.