Philosopher dinner - Solution 3

State diagram

When a philosopher gets hungry, she/he first acquires the left fork.

Then she/he tries to acquire the right one, releasing the left if she/he fails and returning to the hungry state.

Busy waiting and starvation were not avoided in this solution.

Last updated