Deadlock prevention

Denying the necessary conditions

Denying the circular wait condition can be done by assigning a different numeric id to every resource and imposing that resource acquisition must be done either in ascending or descending order.

  • This way the circular chain is always avoided.

  • Starvation is not avoided.

In the dining-philosopher problem, this can be done imposing that one of the philosophers acquires first the right fork and then the left one.

Last updated