A solution to the Dining Philosophers Problem which avoids deadlock is:
19962025
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
Attempted by 78 students.
Show answer & explanation
Correct answer: C
In the classic Dining Philosophers problem, if every philosopher follows the exact same strategy (e.g., everyone picks up their left fork first), a deadlock occurs. When all philosophers sit down at the same time, each will pick up their left fork, and everyone will block indefinitely waiting for their right fork to become free. This creates a perfect loop of dependency (Circular Wait).
To avoid deadlock, we must introduce an asymmetric strategy to break the symmetry:
If we make one particular philosopher behave differently from the rest (for example, Philosopher 5 picks up their left fork first, while Philosophers 1, 2, 3, and 4 pick up their right fork first), we completely disrupt the circular wait condition.
In this setup, at least one fork will always remain unallocated when everyone tries to eat simultaneously. This ensures that at least one philosopher can successfully acquire both forks, eat, and release them back to the table, allowing the system to make forward progress.