• edited by
34,375 views
68 68 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..

5 Answers

Best answer
107 107 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
95 95 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.

7 7 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 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.
0 0 votes
(a) Circular wait is a necessary condition for the formation of deadlock. TRUE

(b) In a system where each resource has more than one instance, a cycle in its wait-for graph indicates the presence of a deadlock. FALSE. Every cycle is not a deadlock but every deadlock have a cycle.

c) If the current allocation of resources to processes leads the system to unsafe state

 then deadlock will necessarily occur. FALSE. Every unsafe state is not deadlock.

(d) In the resource-allocation graph of a system, if every edge is an assignment edge,

then the system is not in deadlock state. TRUE.

Only hold without wait doesn’t cause deadlock. Therefore, option A, D are correct.
Answer:
Position:
Show:

Related questions

74 74 votes
4 answers 4 answers
36.2k
36.2k views
Kathleen asked Sep 12, 2014
36,202 views
Which of the following are NOT true in a pipelined processor?Bypassing can handle all RAW hazardsRegister renaming can eliminate all register carried WAR hazardsControl h...
42 42 votes
4 answers 4 answers
20.3k
20.3k views
Kathleen asked Sep 12, 2014
20,339 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$
34 34 votes
5 answers 5 answers
13.3k
13.3k views
Kathleen asked Sep 12, 2014
13,334 views
Which of the following statements is false?Every NFA can be converted to an equivalent DFAEvery non-deterministic Turing machine can be converted to an equivalent determi...
62 62 votes
5 answers 5 answers
25.6k
25.6k views
Kathleen asked Sep 12, 2014
25,589 views
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fi...