The various strategies to handle deadlocks are:
- Deadlock prevention
- Deadlock avoidance
- Deadlock recovery
- Deadlock ignorance
1. Deadlock Prevention :
Measures are taken so that the system does not go into deadlock condition in the first place. The deadlock prevention techniques prevent the occurrence of at least one of the four conditions that cause deadlock.
2. Deadlock avoidance :
In deadlock avoidance, before a process is allocated requested resources it is made sure that the request will not lead to deadlock, In order to decide whether the current request can be satisfied or must be delayed, the system should consider : the resources currently available, the resources currently allocated to each process and the future requests and releases of each process.
3. Deadlock recovery :
It means, let the deadlock occur in the system and then detect it and recover the system from deadlock. In this environment, the system can provides an algorithm that examines the state of a system to determine whether a deadlock has occurred and can then use an algorithm to recover from the deadlock.
4. Deadlock ignorance :
An operating can assume that deadlock will never happen or rarely occur and fully ignore it. This approach is also known as no policy approach. The advantage of this approach is that it saves CPU time and memory space for deadlock management, unlike those required for detection, prevention or avoidance methods. This strategy is used in UNIX.