# GATE - 1996 | OS | A solution to the Dining Philosophers Problem which avoids deadlock is

## Questions:

A solution to the Dining Philosophers Problem which avoids deadlock is

 A ensure that all philosophers pick up the left fork before the right fork B ensure that all philosophers pick up the right fork before the left fork C ensure that one particular philosopher picks up the left fork before the right fork, and that all other philosophers pick up the right fork before the left fork D None of the above

## Solution:

### Option (C) is Correct.

In the Dining philosopher problem, each philosopher needs exactly two chopsticks to eat food but the problem is: each philosopher is going to take one chopstick at a time, which is placed at its right-hand side or at its left-hand side, but remember all should choose in the same manner like if first one chooses in a clockwise manner then each one should choose in clockwise, this type of picking cause, a circular waiting loop because each one is depending on other.

This is also called as circular waiting and it leads to deadlock.

To avoid this, atleast one philosopher should choose its first chopstick in different way so that circular loop is not formed.

Thank You