Philosopher dinner - Solution 4
Last updated
Last updated
Philosophers are numbered from 0 to N − 1.
Every fork is assigned an id, equal to the id of the philosopher at its left, for instance.
Every philosopher, acquires first the fork with the lower id.
This way, philosophers 0 to N − 2 acquire the left fork, while philosopher N − 1 acquires the right one.