Skip to content

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.

Notifications You must be signed in to change notification settings

SolarisCode/philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

philosophers

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.

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.

Topics

Resources

Stars

Watchers

Forks