edited by
23,724 views
54 votes
54 votes

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..

edited by

4 Answers

Best answer
85 votes
85 votes

(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

edited by
68 votes
68 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.

4 votes
4 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)

3 votes
3 votes
option A. In order to prevent deadlock we number the resources and resources are granted to process only in increasing fashion ( to avoid circular wait) so even if the resulting re resource request results in safe sequence and it is not in increasing order then that request will be rejected.

option B. yes, the banker algorithm states that.

option C. same explanation as option A

option D. yes we should know in advance the max instances of each resource a process will be requiring.
Answer:

Related questions

26 votes
26 votes
2 answers
1
Kathleen asked Sep 12, 2014
13,661 views
If a class $B$ network on the Internet has a subnet mask of $255.255.248.0$, what is the maximum number of hosts per subnet?$1022$$1023$$2046$$2047$
70 votes
70 votes
5 answers
4
Kathleen asked Sep 12, 2014
13,847 views
Let $\text{fsa}$ and $\text{pda}$ be two predicates such that $\text{fsa}(x)$ means $x$ is a finite state automaton and $\text{pda}(y)$ means that $y$ is a pushdown autom...