The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+26 votes
4k views

Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?

  1. In deadlock prevention, the request for resources is always granted if the resulting state is safe

  2. In deadlock avoidance, the request for resources is always granted if the resulting state is safe

  3. Deadlock avoidance is less restrictive than deadlock prevention

  4. Deadlock avoidance requires knowledge of resource requirements apriori..

asked in Operating System by Veteran (59.5k points)
edited by | 4k views

3 Answers

+40 votes
Best answer

(A).  In deadlock prevention, we just need to ensure one of the four necessary conditions of deadlock doesn't occur. So, it may be the case that a resource request might be rejected even if the resulting state is safe. (One example, is when we impose a strict ordering for the processes to request resources). 

Deadlock avoidance is less restrictive than deadlock prevention. Deadlock avoidance is like a police man and deadlock prevention is like a traffic light. The former is less restrictive and allows more concurrency. 

Reference: http://www.cs.jhu.edu/~yairamir/cs418/os4/tsld010.htm

answered by Veteran (355k points)
edited by
+11

A)False

B) Banker algorithm . Here we have to know resulting state is safe or not.

C) yes, in deadlock prevention we have to check all 4 necessary conditions., while in deadlock avoidance we need to check safe sequence . Say u want to go to college by bike. But u have no license. So, to avoid traffic police, u choose other road and not to go with main road. That is deadlock avoidance .

Deadlock prevention u made license and then go by main road only.

D)Knowledge of resource requirement nothing but Banker algo. Where we need to know max available resource, no of resource needed etc.

"aprori" here means it is a theoretical observation  link

+2
Example of policeman and traffic light is awesome. I understand whole concept with this example.
+3
Sir,you mean police man is less restrictive than traffic light:p
+8
Yes. Suppose if in one road no vehicles are there, policeman will allow vehicles from other roads but not a traffic light. But let's wait for traffic lights being made with AI by the CS geeks here :)
+27 votes

Option A is answer.
The main difference between deadlock prevention and deadlock avoidance lies in the definition of deadlock itself.
We know Necessary_conditions for deadlock to happen. Means deadlock can be there only if these conditions are satisfied. But it does not mean that if these conditions are satisfied then deadlock will always be there.

The above definition is the main idea and fine line on that both strategies differ.

Deadlock Prevention says: Let's prevents one of the conditions.
Deadlock Avoidance says: Let me allow all conditions to hold simultaneously (all conditions holds simultaneously doesn't guarantee deadlock) but I will also check any chance of deadlock (i.e system in the safe state if I allocate requested resource.), It allows the four conditions but makes judicious decisions so that the deadlock point is not potentially reached.

Clearly, Deadlock prevention is more restrictive. It decreases throughput also. At the same time we can not use Deadlock avoidance practically as it demands to know uses of all resources in advance.

The analogy is like this:
(Now take an example of protection from viral through the water.)
Deadlock Prevention: Don't use water
Deadlock Avoidance: Use water but first filter out.

answered by Boss (15.9k points)
+1
indeed a nice answer.
+1

" We know Necessary_conditions for deadlock to happen. Means deadlock can be there only if these conditions are satisfied. But it does not mean that if these conditions are satisfied then deadlock will always be there."

Can u give me example "4 condition satisfied and deadlock not satisfied" ?

+6
In one word ,

In case of deadlock prevention we have to check all 4 necessary conditions... while in deadlock avoidance we just need to check system is in safe state or not !

so less task for avoidance hence less strict that prevention :)
+2 votes

Deadlock prevention scheme handles deadlock by making sure that one of the four necessary conditions don't occur. In deadlock prevention, the request for a resource may not be granted even if the resulting state is safe. (See the Galvin book slides for more details)

answered by Loyal (8.8k points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,115 questions
45,621 answers
132,332 comments
49,306 users