The answer should be 5. The no. of instances of a particular resource type should be one more than the worst case allocation. In this case, the worst case allocation would be that each process would receive one less than its demand i.e. one tape drive each. Since total tape drives are 6, we can have 5 processes holding 1 tape drive each. And the additional tape drive will help to complete the task of one process and then the finished process resources can be allocated to other processes and so on.

With number of process n = 3, the drive allocation among process is (2,2,2),which allow all the 3 processes to complete : It is deadlock free
With number of process n = 4, the drive allocation among process is (2,2,1,1),which allow first two processes to complete : It is deadlock free
With number of process n = 5, the drive allocation among process is (2,1,1,1,1),which allow first to complete : It is deadlock free

With number of process n = 6, the drive allocation among process is (1,1,1,1,1,1).Each process holding one tape drive and waiting for another one and hence there is deadlock.

The best way to solve this type of question is give each process one resource less than it requires and give one process all the resources it needs

in this question suppose give p1 all its resources which is 2 in this case, now left over resources are 4 tape drives, give all other processes one resource less it i.e 1,1,1,1 therefore total process=p1+4 other processes with 1 tape drive each=5

this approach also helps you solving question to find the min no of tape drives when no. of processes are given.

suppose question was there are 5 processes requiring 2 tape drives each then what is the min no of tape drives to keep the system deadlock free

give all one less resources i.e p1=1 resource.....and so on p5=1 resource, now with one more resource left satisfy one of the process' neeeds..i.w min no of resources= 5+1=6.

This way is logical, because it comes directly as a conclusion of Banker's algorithm if we set the no of instances=1.

The answer should be 5. The no. of instances of a particular resource type should be one more than the worst case allocation. In this case, the worst case allocation would be that each process would receive one less than its demand i.e. one tape drive each. Since total tape drives are 6, we can have 5 processes holding 1 tape drive each. And the additional tape drive will help to complete the task of one process and then the finished process resources can be allocated to other processes and so on.

Right answer should be 5.

ExplanationWith number of process n = 3, the drive allocation among process is (2,2,2),which allow all the 3 processes to complete : It is deadlock free

With number of process n = 4, the drive allocation among process is (2,2,1,1),which allow first two processes to complete : It is deadlock free

With number of process n = 5, the drive allocation among process is (2,1,1,1,1),which allow first to complete : It is deadlock free

With number of process n = 6, the drive allocation among process is (1,1,1,1,1,1).Each process holding one tape drive and waiting for another one and hence there is deadlock.

Hence for n < 6 the system is deadlock free....

The best way to solve this type of question is give each process one resource less than it requires and give one process all the resources it needs

in this question suppose give p1 all its resources which is 2 in this case, now left over resources are 4 tape drives, give all other processes one resource less it i.e 1,1,1,1 therefore total process=p1+4 other processes with 1 tape drive each=5

this approach also helps you solving question to find the min no of tape drives when no. of processes are given.

suppose question was there are 5 processes requiring 2 tape drives each then what is the min no of tape drives to keep the system deadlock free

give all one less resources i.e p1=1 resource.....and so on p5=1 resource, now with one more resource left satisfy one of the process' neeeds..i.w min no of resources= 5+1=6.

This way is logical, because it comes directly as a conclusion of Banker's algorithm if we set the no of instances=1.

Ans is 5..

P1 : 1 1

P2 : 1

P3 : 1

P4 : 1

P5 : 1