Philosophers is a 42 project about threading and concurency. The objective is to simulate the dining philosophers problem in a program which lets you define how many philosophers are at the table as well as how long they sleep, eat and have to eat before dying.
- Multi-hreaded simulation - In the philo binary, each philosopher is a thread
- Multi-process simulation - In the philo_bonus binary, each philosopher is a process
Download from latest
- GCC compiler
- Make
- Clone the repository
git clone https://github.com/ghostyghast/philosophers
cd philosophers/- Compile the project
make -C ./philo
make -C ./philo_bonusYou must define :
- how many philosophers are dining
- how long they can live before having a meal in ms
- how long they take to eat in ms
- how long they take to sleep in ms.
- (optionally) how many meals they have to eat before leaving the table
philo <number of philos> <life duration> <eat duration> <sleep duration> [meals to eat]
For a clearer understanding of a timeline of events, you can paste your output into this visualiser
This project is part of the 42 School curriculum and follows the school's academic guidelines.
