Andrew King

Andrew King

Dining Philosophers Deadlock Solution

Dining Philosophers


If you specify that one thread must acquire its right fork before its left fork it prevents deadlock. This is a form of resource ordering that prevents the deadlock cycle because one philosopher can not be holding the left fork waiting for the right, they can only be holding the right waiting for the left. The rest of the philosophers must pick up their left before the right so you avoid the deadlock situation as shown in the provided image.