Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 779 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 779 Bytes

Philosophers 🍝 😴 🧘‍♀️

A C programming answer to Dijkstra's dining philosophers problem using threads and mutexes.

Problem 🥢

A group of philosophers sit around a table with a bowl of spaghetti in the middle. Each must eat to survive but each only brought one fork (originally a chopstick) and needs two forks to eat the spaghetti. Therefore, they must take turns eating, sleeping and thinking in order to stay fed and avoid starving to death. This is achieved through the use of threads and mutexes.

User inputs the following:

  • number_of_philosophersc
  • time_to_die;
  • time_to_eat;
  • time_to_sleep;
    and, optionally,
  • number_of_times_each_philosopher_must_eat

Results 🖋️

Success with 100%