Q2. Explain Deadlock Avoidance.
Ans. This approach to avoid the deadlock problem anticipates deadlock before it actually occurs. It employs an algorithm to access the possibility that deadlock could occur and acting accordingly. This method differs from deadlock prevention as its guarantees that deadlock cannot occur by denying one of the necessary conditions of deadlock.
In deadlock avoidance, we attempt to falsify one or more of the necessary conditions in a dynamic way by keeping track of the current state and the possible future conditions. The idea is to let the necessary conditions prevail as long as they do not cause a deadlock but falsify them as soon as a deadlock becomes a possibility in the immediate future. As a result, deadlock avoidance leads to better resource utilization.