To be, or not to be, that is the question A multithread 42 project.
• One or more philosophers are sitting at a round table either eating, either thinking, either sleeping. While they are eating, they do not think or sleep; while thinking they don’t eat or sleep; and, of course, while sleeping, they do not eat or think.
• The philosophers sit at a circular table with a large bowl of spaghetti in the center.
• There are some forks on the table. Serving and eating spaghetti with a single fork is very inconvenient, so the philosophers will eat with two forks, one for each hand.
• Each time a philosopher finishes eating, they will drop their forks and start sleeping. Once they have finished sleeping, they will start thinking. The simulation stops when a philosopher dies.
• Every philosopher needs to eat and they should never starve.
• Philosophers don’t speak with each other.
• Philosophers don’t know when another philosopher is about to die.
• No need to say that philosophers should avoid dying!
Passed with 100/100