Deadlock Avoidance

In this topic, you will learn about, Deadlock Avoidance.

This approach to the deadlock problem and incipits a deadlock before it actually occurs. This method defers from deadlock prevention. The most famous deadlock avoidance algorithm from Dijkstra (1965), is the Banker’s algorithm.

Banker’s Algorithm:

The banker’s algorithm is based on the banking system, which never allocates its available cash in such a manner that it can no longer satisfy the needs of all customers. Here we must have the advance knowledge of the maximum possible claims for each process which is limited by the resource availability. During the run of the system, we should keep monitoring the resource allocation status to ensure that no circular weight condition can exist.

The following are the features that are to be considered for the avoidance of the deadlocks as per the banker’s algorithm:

  1. Each process declares maximum no of resources of each type that it may need.
  2. Keep the system in a safe state in which we can allocate resources to each process in some order and avoid deadlock.
  3. Check for the safe state by finding a safe sequence- P1, P2, ……. Pn, where a resource that Pi needs can be satisfied by Available resource + resource hailed by Pj where J < I.

Limitation of Banker’s Algorithm:

There are some problems with the banker’s algorithm as follows:

  1. It is time-consuming to execute the operation of every resource.
  2. If the claim information is not accurate, system resources may be under-utilized.
  3. Another difficulty can occur when a system is heavily loaded.
  4. New processes arriving may cause a problem.
  5. A resource becoming unavailable can result in an unsafe state.

Comment below if you have queries related to the above topic, Deadlock Avoidance.