/**/ Deadlock Prevention - Dextutor - Operating System

Deadlock Prevention

Deadlock prevention means to prevent at least one of the necessary conditions from occurring. The methods to prevent the individual conditions are discussed below:

Mutual exclusion

Mutual exclusion can not be prevented since it is the intrinsic property of the resource. E.g. printer is non sharable.

Hold and wait

Hold and wait can be prevented by ensuring that whenever a process request a resource, it must not be holding any resource. There are two ways of doing it:

  • Every process must be allocated all the resources before it begins execution.
  • Whenever a process request for resources, it must release all the currently held resources (if any).


  • Low resource utilization
  • Starvation is possible
No preemption

No preemption can be prevented by implementing resource preemption. If the requested resources can not be allocated then the resources that are currently held by the process are preempted. It is different from hold and wait where the currently held resources are release first and then a request for all resources is made again.

This can be applied to resources like CPU registers and memory space but not to printers and tape drives.

Circular wait

Circular wait can be prevented by ensuring that the process can request for resources in some order only.

E.g. Suppose each process is numbered like P0, P1, p2,. .., Pn. Then they can request for resources held by higher numbered process only i.e. P0 can request from P1, P2 and so on, p1 from P2, P3 and so on but not P0, P2 from P3, P4 and so on but not P0 and P1.

PPT on Deadlock Prevention

The above discussion on deadlock prevention is summarized in the form of a PPT with animations below.
Note: Click within the slide area for animations. Clicking on the “next” slide button will not display any animation

Video on Deadlock Prevention

video on deadlock prevention in operating system

Previous                   Next

Deadlock              Deadlock Avoidance

1 thought on “Deadlock Prevention”

  1. Starvation when two or more threads or processes wait for the same resource, one will roll back and let the others use the resource first and next the starving thread or process will try again therefore all threads or processes will anyhow proceed forward

    the two threads or processes will wait for each other and both do not proceed forward

Leave a Comment