edited by
54,563 views
77 77 votes

A system has $6$ identical resources and $N$ processes competing for them. Each process can request at most $2$ resources. Which one of the following values of $N$ could lead to a deadlock?

  1. $1$
  2. $2$
  3. $3$
  4. $4$

11 Answers

Best answer
69 69 votes
$3 \times 2 = 6$
$4 \times 2 = 8$

I guess a question can't get easier than this- (D) choice. (Also, we can simply take the greatest value among choice for this question)

[There are $6$ resources and all of them must be in use for deadlock. If the system has no other resource dependence, $N=4$ cannot lead to a deadlock. But if $N=4$, the system can be in deadlock in presence of other dependencies.

Why $N=3$ cannot cause deadlock? It can cause deadlock, only if the system is already in deadlock and so the deadlock is independent of the considered resource. Till $N=3,$ all requests for considered resource will always be satisfied and hence there won't be a waiting and hence no deadlock with respect to the considered resource. ]
edited by
14 14 votes
for this type of question always allocate (max_need-1)resource to each process and keep 1 extra resource , allocating that extra resource to any process , the process can execute and all its resources will be available. so in this particular Question max need is 2, allocate (2-1)=1 to each process and u need 1 extra resource, so actually u can support 5 process with 6 resource. as the highest number of process is 4 go for D.

actually min no. of resource required to guarantee deadlock free condition = (sum of all (max_need -1))+1
11 11 votes

Whenever this type of question came, related to resource and deadlock or process and deadlock the simple way to solve is

Allocate each process a resource equal to their maximum need - 1, This type of allocation gives you maximum no resources that lead to deadlock but if you just add 1 to this number you will get minimum no of resources causing no deadlock.

for example 

let us say the total no of resources is R and we have to N process and each can take almost M resource the what is the value of N? 

N * (M-1) + 1 <= R 

for this question, the maximum no of processes is 5 without deadlock, the minimum no of the process causing deadlock is 6 but it is not given in option so go with 4

3 3 votes
supos there are n process p1,p2,p3....pn share m identical resource which can be release/allocate one at the time.

the max resource required for process pi is si, where si>0

the sufficient condition for ensuring that DL doesn't occure:  Σsi(for i=1 to n) < (m+n)

where m= number of resource

      n= number of process

      si= total req(request resource for ith process)
3 3 votes
Nos of Resources=R=6

nos of processes=N

Max demand=P=2

Now deadlock will not occur if R>=N*(P-1)+1 which gives N <=5, Now the max option given  4  which is taken as the solution.

Hence the option D is correct.
Answer:
Position:
Show:

Related questions

43 43 votes
5 answers 5 answers
12.3k
12.3k views
go_editor asked Feb 12, 2015
12,256 views
Consider $6$ memory partitions of sizes $200$ $\text{KB}$, $400$ $\text{KB}$, $600$ $\text{KB}$, $500$ $\text{KB}$, $300$ $\text{KB}$ and $250$ $\text{KB}$, where $\text{...
73 73 votes
9 answers 9 answers
34.1k
34.1k views
go_editor asked Feb 12, 2015
34,115 views
A computer system implements a $40\;\text{-bit}$ virtual address, page size of $8\;\text{kilobytes}$, and a $128\text{-entry}$ translation look-aside buffer $\text{(TLB)}...
60 60 votes
5 answers 5 answers
23.2k
23.2k views
go_editor asked Feb 13, 2015
23,233 views
In a connected graph, a bridge is an edge whose removal disconnects the graph. Which one of the following statements is true?A tree has no bridgesA bridge cannot be part ...
78 78 votes
5 answers 5 answers
28.1k
28.1k views
go_editor asked Feb 12, 2015
28,104 views
Consider a processor with byte-addressable memory. Assume that all registers, including program counter (PC) and Program Status Word (PSW), are size of two bytes. A stack...