This project is the first one in the 42 curriculum that requires the use of threads. The goal is to simulate the Dining Philosophers problem, where multiple philosopher threads share resources (forks) to eat spaghetti. The project involves managing synchronization and preventing issues that arise with concurrent processes.
- Multi threads
- Data Racing: Address and resolve issues of data races between philosopher threads.
- Deadlocks: Prevent and handle deadlocks caused by mutexes used for resource management.
- Philosopher Lifecycle: Implement mechanisms to monitor and manage the time philosophers spend eating and prevent them from "dying" due to starvation.
To compile the project, go to its path and run:
For mandatory functions:
$ make
To delete all files generated with make, go to the path and run:
$ make fclean
- ./philo [Number_of_philo] [Time_to_die] [Time_to_eat] [Time_to_sleep] [OPTIONAL: Number_of_time_need_to_eat]
$ ./philo 10 800 200 200 5
This project have been tested with Nafuka Visualizer.