The Gateway to Computer Science Excellence
+8 votes

What is the minimum number of resources required to ensure that deadlock will never occur, if there are currently three processes $P_1, P_2$ and $P_3$ running in a system whose maximum demand for the resources of same type are 3, 4, and 5 respectively.

  1. 3
  2. 7
  3. 9
  4. 10
in Operating System by Veteran (105k points) | 2.2k views

3 Answers

+15 votes
Best answer
consider the worst case all processes holding just one resource less than their completion(max need)




TOTAL RESOURCE =9  now one more resource will ensure that any one of these process will execute and release all its resources

hence 9+1=10 resources will ensure there will not be deadlock hence ans is D
by Boss (49.3k points)
selected by
what will be the ans if the condition changed to "deadlock always occur"....????
deadlock may or may not occur when the resources are less than 10... i think deadlock always occur we cannot say as it depends on the allocation of resources...for example consider 2 resources if these two resources are allocated to p1..and no resources are allocated to p2,p3...there is no deadlock...but no process completes also.
? i did not get after 9 , how u wrote total resources =10

plz explain
it is just a case when resources becomes 10  there is no deadlock
beacuse for maximum no for happing dead lock if  we provided resource




2+3+4=9 means if we have 9 process so there is chance that deadlock may happen thats why min no will be 10 resource we can ensure that there will no deadlock
+3 votes

Option D will right option for it.

We have processes like P1,P2 and P3 now assign each one of them 2,3 and 4 units.This is condition for deadlock if we assign one more unit to any one of the processes then deadlock will be broken .Therefore minimum resourses required is 10.

by Boss (10.2k points)
+3 votes
Short trick for these kind of questions-

subtract 1 from "all" max demands,like

3-1 = 2

4-1= 3

5-1 = 4

add all of them = 2+3+4 = 9

then add 1 to it 9+1 =10 so answer is D
by Loyal (9.9k points)

Related questions

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
50,741 questions
57,241 answers
104,603 users