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