reopened by
4,264 views
9 votes
9 votes

A system has 10 identical resources and N processes competing for them. Each process can request atmost 3 resources but by grouping of first 3 processes needs only 6 resources. Then, the maximum value of ‘N’ is _______.

reopened by

3 Answers

Best answer
11 votes
11 votes
First, 3 processes combined demand is 6.

Let combined they needed a, b, c resources.

a + b + c <= 6.

And every other process will require 3 resources. Let these processes be x.

By applying pigeonhole principle.

(a - 1) + (b -1) + (c-1) + x(3 - 1) + 1 <= 10.

a + b + c - 3 + 2x  + 1 <= 10

6 - 3 + 1 + 2x  <= 10

4 + 2x <= 10

2x <= 6

x = 3.

So total no. of processes will be x + 3 = 6 processes.
edited by
4 votes
4 votes

CORRECT APPROACH

We need to break the resource requirements of P1,P2,P3 keeping in mind 2 things :

1) Each process can request atmost 3 resources

2)By grouping of first 3 processes needs only 6 resources

Possible pairs:(P1,P2,P3)

(0,3,3) , (1,2,3), (2,2,2), (and consider possible permutations of these)

Max resources that ensure deadlock : 2+2 =4 ,  0+1+2=3 , 1+1+1=3

Let the allocation be as follows : (#resources=10)

P1,P2,P3 --> Allocation=4

P4  ---> Allocation=2

P5  ---> Allocation=2

P6  ---> Allocation=2

Now, There is DEADLOCK In the system .Why?

P1,P2,P3 need one more resource to complete in WORST CASE(0,3,3)

P4 need one resource to complete

P5 need one resource to complete

P6 need one resources to complete

As a result all are waiting onto each other and no one continues execution further and Hence,Deadlock !

Now, Whats the correct answer then ?

Maximum processes allowed should  be 5.

P1,P2,P3 --> Max requirement=6

P4  ---> Max requirement=3

P5  ---> Max requirement=3

Let the allocation be as follows : (#resources=10)

P1,P2,P3 --> Allocation=4

P4  ---> Allocation=2

P5  ---> Allocation=2


Now,Till now #resources used =8 , #resources remaining=2

This remaining resource can be allocated to any process P1,P2,P3 or P4 or P5

In either case , that set to whom we allocate the last resource is compelled to complete and release all its resources and hence other processes may then complete their executions.Now, ABSOLUTELY NO POSSIBILITY OF DEADLOCK NO MATTER HOW THE PROCESSES ARE REQUESTING AND HOW THE ALLOCATION IS DONE.

CORRECT ANS=5 processes

edited by
2 votes
2 votes

answer should be 6. In worst case more than 6  processes accessing resources simultaneously may lead to deadlock.

edited by

No related questions found