Operating systems: Deadlock concept


#1

If there are 6 processes and each requires 2 resources.Then what are the minimum number of resources to prevent deadlock?

A) 6
B) 7
C)9
D)5


#2

Use the deadlock free condition i.e. R>=P(N-1)+1.Here R=? , P=no. of processes =6 and N= request =2. which gives R>=6(2-1)+1 ie. R>=7. Hence minimum number of resources to prevent deadlock is 7.


#3

suppose To occur deadlock all process acquires 1 resources (less than 1 it required) so 6 process acquires 6 requires. so to avoid deadlock we need at least one resource which will full fill the need of one process.later that process executes and releases resources which will be acquired by other process.


#4

Now it depends on conditions, 6 may be the minimum number, because if each process consumes one resource i.e., 6 resources and share the resources simultaneously then there will be no deadlock, but if the resource1 is required by process 2 and process 3 at same time then the answer 6 is not valid. So, thinking of worst case atleast 9 can also be the answer. But since minimum is asked 6 is the minimum number


#5

p1=1| p2=1| p3=1| p4=1| p5=1| p6=1

+1 to any process so that it can complete its work and can forward the resources to other processes.
So minimum 7 resources are required.