This project is about writing a program that simulates a group of philosophers dining at a round table. The philosophers take turns eating, thinking, and sleeping. There is a bowl of spaghetti in the middle of the table, and each philosopher needs two forks to eat. The philosophers must follow certain rules, such as not talking to each other and not knowing when another philosopher is about to die. The goal of the program is to avoid deadlocks and ensure that all philosophers eat.
The bonus part of this project involves adding support for philosophers with processes and semaphores. In this part, all the forks are put in the middle of the table and they have no states in memory. Instead, the number of available forks is represented by a semaphore. Each philosopher should be a process, but the main process should not be a philosopher.
To build the project, run the following command in the project directory:
make
This will create the philo or philo_bonus
executable.
To run the program, run the following command in the project directory:
./philo_bonus or ./philo number_of_philosopher time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]
- Minishell: This project is about creating a feature-rich shell program.
- Webserv: This project is aimed to create a feature-rich webserver.
- GitHub: Ziko909
- LinkedIn: Zakaria Aabou
- Gmail: [email protected]