/philosophers_v2

Solving dining philosophers problem with threads and mutex

Primary LanguageC

In computer science, The dining philosophers problem is an example problem often used in concurrent algorithm design to illustrate synchronization issues and techniques for resolving them. Philosophers project requires to solve The Dining Philosopher Problem problem using threads and mutex. The solution was implemented using a monitor function (being called in main hread), which checks if any philosopher has died and warns others to stop (locking mutex).

Access the folder

cd philo

Compile

make

Run the program with <number_of_philosophers> <time_to_die> <time_to_eat> <time_to_sleep> [number_of_times_each_philosopher_must_eat (optional argument)]

./philo 5 800 200 200 7

Remove objects

make clean

Remove objects and executable

make fclean