Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Difference between Deadlock Prevention and Deadlock Avoidance

  • Difficulty Level : Easy
  • Last Updated : 14 Sep, 2021

1. Deadlock Prevention : 
Deadlock prevention means to block at least one of the four conditions required for deadlock to occur. If we are able to block any one of them then deadlock can be prevented. 

The four conditions which need to be blocked are:- 

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

  1. Mutual Exclusion
  2. Hold and Wait
  3. No Preemption
  4. Circular Wait

Spooling and non-blocking synchronization algorithms are used to prevent the above conditions.In deadlock prevention all the requests are granted in a finite amount of time. 

2. Deadlock Avoidance : 
In Deadlock avoidance we have to anticipate deadlock before it really occurs and ensure that the system does not go in unsafe state.It is possible to avoid deadlock if resources are allocated carefully. For deadlock avoidance we use Banker’s and Safety algorithm for resource allocation purpose. In deadlock avoidance the maximum number of resources of each type that will be needed are stated at the beginning of the process. 

Difference between Deadlock Prevention and Deadlock Avoidance : 

S.NO.FactorsDeadlock PreventionDeadlock Avoidance
1.ConceptIt blocks at least one of the conditions necessary for deadlock to occur.It ensures that system does not go in unsafe state
2.Resource RequestAll the resources are requested together.Resource requests are done according to the available safe path.
3.Information requiredIt does not requires information about existing resources, available resources and resource requestsIt requires information about existing resources, available resources and resource requests
4.ProcedureIt prevents deadlock by constraining resource request process and handling of resources.It automatically considers requests and check whether it is safe for system or not.
5.PreemptionSometimes, preemption occurs more frequently.In deadlock avoidance there is no preemption.
6.Resource allocation strategyResource allocation strategy for deadlock prevention is conservative.Resource allocation strategy for deadlock prevention is not conservative.
7.Future resource requestsIt doesn’t requires knowledge of future process resource requests.It requires knowledge of future process resource requests.
8.AdvantageIt doesn’t have any cost involved because it has to just make one of the conditions false so that deadlock doesn’t occur.There is no system under-utilization as this method works dynamically to allocate the resources.
9.DisadvantageDeadlock prevention has low device utilization.Deadlock avoidance can block processes for too long.
10.ExampleSpooling and non-blocking synchronization algorithms are used.Banker’s and safety algorithm is used.
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!