This C application demonstrates a solution to the dining philosophers problem using multithreading and mutual exclusion. The program simulates multiple philosophers sitting at a table, each with a plate of spaghetti and two forks. Philosophers alternate between thinking and eating, but must acquire both forks to eat. To avoid deadlocks, forks are shared and protected by mutex locks.
-
Notifications
You must be signed in to change notification settings - Fork 0
This C application solves the classic dining philosophers problem using threads and mutexes. It implements a deadlock avoidance algorithm and allows the user to specify the number of philosophers, the time each philosopher spends eating, sleeping and how many times each one should eat.
SolarisCode/philosophers
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
This C application solves the classic dining philosophers problem using threads and mutexes. It implements a deadlock avoidance algorithm and allows the user to specify the number of philosophers, the time each philosopher spends eating, sleeping and how many times each one should eat.