DEADLOCK AVOIDANCE
One famous algorithm to describe deadlock avoidance is Banker’s algorithm
DIJKSTRA'S BANKER’S ALGORITHM:
The banker's Algorithm is easily expendable to pools of resources of several different types. A decision is made dynamically whether the current allocation of resource request dynamically and potentially that may lead to a deadlock or not. Requires knowledge of future process request
There are two approaches to avoided the deadlock avoidance in banker algorithm.
- Do not start a process if its demands might lead to deadlock
- Do not grant an incremental resource request to a process if this allocation might lead to deadlock.
1. SAFE STATE:
A safe state is one in which there is at least one sequence that does not result in a deadlock. It consists of four processes and three resources. This concept suggests the deadlock avoidance which ensure that system of processes and resources is always in safe state. In safe state the required resources are always less than the available resources.
• EXAMPLE OF A SAFE STATE:
Suppose a system has 12 equivalent tape drives, and 3 users sharing the drives as in State I.
Current Loan Maximum Need
User (1) 1 4
User (2) 4 6
User (3) 5 8
Available 2
2. UNSAFE STATE:
An unsafe state is a state that is not safe OR an unsafe state is one that lead to deadlock. In unsafe state the required resources are always greater than the available resources is called unsafe state.
EXAMPLE OF A UNSAFE STATE:
Assume a system's twelve tape drives are allocated as in State II.
State II
Current Loan Maximum Need
User (1) 8 10
User (2) 2 5
User (3) 1 3
Available 1
One famous algorithm to describe deadlock avoidance is Banker’s algorithm
DIJKSTRA'S BANKER’S ALGORITHM:
The banker's Algorithm is easily expendable to pools of resources of several different types. A decision is made dynamically whether the current allocation of resource request dynamically and potentially that may lead to a deadlock or not. Requires knowledge of future process request
There are two approaches to avoided the deadlock avoidance in banker algorithm.
- Do not start a process if its demands might lead to deadlock
- Do not grant an incremental resource request to a process if this allocation might lead to deadlock.
1. SAFE STATE:
A safe state is one in which there is at least one sequence that does not result in a deadlock. It consists of four processes and three resources. This concept suggests the deadlock avoidance which ensure that system of processes and resources is always in safe state. In safe state the required resources are always less than the available resources.
• EXAMPLE OF A SAFE STATE:
Suppose a system has 12 equivalent tape drives, and 3 users sharing the drives as in State I.
Current Loan Maximum Need
User (1) 1 4
User (2) 4 6
User (3) 5 8
Available 2
2. UNSAFE STATE:
An unsafe state is a state that is not safe OR an unsafe state is one that lead to deadlock. In unsafe state the required resources are always greater than the available resources is called unsafe state.
EXAMPLE OF A UNSAFE STATE:
Assume a system's twelve tape drives are allocated as in State II.
State II
Current Loan Maximum Need
User (1) 8 10
User (2) 2 5
User (3) 1 3
Available 1