2.2k views

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
| 2.2k views

consider the worst case all processes holding just one resource less than their completion(max need)

P1=2

P2=3

P3=4

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
+1
what will be the ans if the condition changed to "deadlock always occur"....????
+2
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.
0
? i did not get after 9 , how u wrote total resources =10

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

p1=2

p2=3

p3=4

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

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

by Loyal (9.9k points)