Deadlock Handling Methods | Deadlock Prevention and Avoidance | Deadlock Detection and Recovery | The Ostrich Approach

There are following strategies to handle deadlock in the system.

 

Deadlock Prevention and Avoidance

Deadlock prevention and deadlock avoidance occurs before system is deadlocked. Deadlock prevention ensure to negate at least one of the four conditions, so system will never enter a deadlock state. That means among four mutual exclusion, no prevention, hold and wait and circular wait can be avoid or deny by sharing, preemption, and increasing order resources requests.

Deadlock avoidance require careful resource allocation to avoid deadlock in the system. If the resource allocation is safe state then we allocate resources to processes otherwise deadlock can be occurred.

 

Deadlock Detection and Recovery

Deadlock detection and deadlock recovery occurs after system is deadlocked. We can detect deadlock using resource allocation graph (RAG). Deadlock occurs if the RAG has cycle in single instances resources type, but deadlock may be occurs if the RAG has cycle in multiple instances resources type. To check deadlock in multiple instance resources we use Banker’s algorithm.

When we terminate forcefully a process which involved in deadlock then this is known as deadlock recovery.

 

The Ostrich Approach

This algorithm ignore the deadlock problem.

 

In general, there are four strategies of dealing with deadlock problem:

1. The Ostrich Approach

Just ignore the deadlock problem altogether.

2. Deadlock Detection and Recovery

Detect deadlock and, when it occurs, take steps to recover.

3. Deadlock Avoidance

Avoid deadlock by careful resource scheduling.

4. Deadlock Prevention

Prevent deadlock by resource scheduling so as to negate at least one of the four conditions.

 

0Comment

What to read next

Please Go through all these linksW3Schools – HTML Tutorial

DefinitionFiber optics is the technology used to transmit information as pulses of light through strands of fiber made of glass or plastic over long