Methods For Deadlock Prevention.

Deadlock prevention(Methods For Deadlock Prevention) is an approach used by designers in dealing with the problem of deadlock. The basic philosophy of deadlock prevention is to delay at least one of the four necessary conditions for deadlocks.

Methods For Deadlock Prevention:

1. Mutual exclusion:

The mutual condition must hold for non-sharable resources, such as a printer that can not be simultaneously shared by several processes.

On the other hand, sharable resources do not require mutually exclusive access and thus can not be involved in a deadlock. for example, read-only files can not be accessed simultaneously by several processes.

To prevent mutual exclusion, avoid assigning a resource when that is not absolutely necessary, and try to make sure that a few processes may claim the resource as possible.

2. Hold and wait:

The hold and wait condition can be eliminated by forcing a process to release all resources held by it whenever it requests a resource that is not available. There are two protocols to implement this strategy

  • The process requests all needed resources before it begins execution. We can implement this provision by requiring that system calls request resources for a process that precedes all other system calls.
  • The second protocols allow a process to request resources only when the process has none. A process requests resources and uses them. Before it can request any additional resources, however, it must release all the resources that are currently allocated.

These protocols have two main disadvantages:

  • Resource utilization may be slow, since many of the resources may be allocated but unused for a long period.
  • starvation is possible.

3. No preemption:

This condition can be prevented using the following protocols. If a process holding certain resources is denied a further request, that process must release its original resources, if necessary, request them again together with the additional resource.

Alternatively, if a process requests a resource that is currently held by another process, the operating system may preempt the second process and require it to release its resources and allocate them to the requesting process.

This latter scheme prevents deadlock only if no two processes are processed with the same priority.

This protocol is practical only when applied to resources whose start can be saved and restored later, such as CPU registers and memory space.

3. Circular wait:

The circular wait condition can be prevented by defining a linear ordering of resource types. If a process has been allocated resources of type R, then it may be subsequently requested only those resources of types following R in the ordering.

A disadvantage of this approach is that resources must be acquired in the prescribed order as opposed to being requested when actually needed. This may cause some resources to be acquired in advance of their use, Thus lowering the degree of concurrency by making unused resources available for allocation to other processes.

You can also go through a few more amazing blog links below related to deadlock:

Deadlock Prevention In OS In Hindi…
Starvation vs Deadlock In Hindi…
Deadlock prevention in os in Hindi…
What Is Deadlock Avoidance OS In Hindi…
What is Deadlock Avoidance In Operating System…
Methods For Deadlock Prevention…
Methods For Deadlock Handling/ Deadlock handling in DBMS…
What is Starvation? How does it differ and is similar to deadlock?…
Deadlock in the distributed operating system in Hindi…

In the case of any queries, you can write to us at we will get back to you ASAP.

Hope! you would have enjoyed this post Methods For Deadlock Prevention.

Please feel free to give your important feedback in the comment section below|Methods For Deadlock Prevention|

Have a great time! Sayonara!


I am a blogger by passion, a software engineer by profession, a singer by consideration and rest of things that I do is for my destination.