Building the thing
Main checklist
This is a checklist containing the main steps you have to do, I don't want to give you too much information, you still have to search things by yourself.
Initiate the threads with said routine
Routine checklist
Create a loop that runs until any of your philosophers die
That's basically it. Your philosophers have to do the following things (in order) in the routine.
Eat
Sleep
Think
Repeat
The most complex thing in this project is to understand how threads work and how you can use mutexes to lock / unlock some values. Once you understood that, you "just" have to make each philosopher eat, sleep and think in a loop. Don't forget to print the logs when the state of your philosophers change.
Final word
I don't want to add more details for this exercise, I want you to search information and really understand how everything works, this is the best I can do for you.
Last updated
Was this helpful?