[2018 : 1 M]
Question3.13: Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is ?
Answer: 2
Reason:
Formula K <= (total + processes -1) / processes ka logic lagta hai. Total=4, processes=3. Agar K=2 hai to worst case me har process ko 1-1 de do to bhi 1 bacha rahega jisse ek process apna kaam pura karke release kar dega. K=3 hone par deadlock possible hai.
[2018 : 2 M]
Question3.14: In a system, there are three types of resources: E, F and G. Four processes P0, P1, P2 and P3 execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max. Allocation matrix as shown below and in which 3 instances of E and 3 instances of F are the only resources available.
Allocation:
P0: E=1 F=0 G=1
P1: E=1 F=1 G=2
P2: E=1 F=0 G=3
P3: E=2 F=0 G=0
Max:
P0: E=4 F=3 G=1
P1: E=2 F=1 G=4
P2: E=1 F=3 G=3
P3: E=5 F=4 G=1
From the perspective of deadlock avoidance, which one of the following is true?
(a) The system is in safe state.
(b) The system is not in safe state, but would be safe if one more instance of E were available.
(c) The system is not in safe state, but would be safe if one more instance of F were available.
(d) The system is not in safe state, but would be safe if one more instance of G were available.
Answer: (a) The system is in safe state.
Reason:
Need = Max – Allocation.
Available = E=3, F=3, G=0.
Need P0(3,3,0) P1(1,0,2) P2(0,3,0) P3(3,4,1)
Available (3,3,0) se P2 ko (0,3,0) de sakte hain. P2 finish hoga to Available (4,3,3) ho jayega.
Phir P1 -> P0 -> P3 ka safe sequence mil jata hai. Isliye system safe hai.
[2022 : 1 M]
Question3.15: In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.
Answer: TRUE
Reason:
Assignment edge hamesha Resource -> Process hoti hai. Agar saari edges assignment hai to iska matlab koi bhi Process -> Resource request edge hi nahi hai, matlab koi process wait hi nahi kar raha. Wait nahi to deadlock impossible.
[2025 (Set-2) : 2 M]
Question3.16: P={P1,P2,P3,P4} consists of all active processes and R={R1,R2,R3,R4} consists of single instances of distinct types of resources. The resource allocation graph has the following assignment and claim edges.
Assignment edges: R1->P1, R2->P2, R3->P3, R4->P4
Claim edges: P1->R2, P2->R3, P3->R1, P2->R4, P4->R2 (the claim edge Pi->Rj means process Pi is waiting for resource Rj)
Which of the following statement(s) is/are CORRECT?
(a) Aborting P1 makes the system deadlock free.
(b) Aborting P2 makes the system deadlock free.
(c) Aborting P3 makes the system deadlock free.
(d) Aborting P1 and P4 makes the system deadlock free.
Answer: (d)
Reason:
Cycle 1: P1->R2->P2->R3->P3->R1->P1
Cycle 2: P2->R4->P4->R2->P2
Sirf P1 ya P2 ya P3 ko abort karne se ek cycle tootega par dusra cycle bacha rahega. P1 aur P4 dono ko abort karne par dono cycles toot jate hain aur system deadlock free ho jata hai.
[2026 (Set-1) : 1 M]
Question3.17: With respect to deadlocks in an operating system, which of the following statements is/are FALSE?
(a) Banker’s algorithm is used to prevent deadlocks
(b) Deadlock formation can be prevented by ensuring that the hold and wait condition is not allowed
(c) An assignment edge in a resource allocation graph is marked from a process to a resource
(d) A safe state guarantees that all processes can finish without formation of a deadlock
Answer: (a) and (c) are FALSE
Reason:
(a) FALSE – Banker’s algorithm prevention nahi, avoidance ke liye use hota hai.
(c) FALSE – Assignment edge hamesha Resource -> Process hoti hai, Process -> Resource to request edge hoti hai.
(b) TRUE – Hold and Wait rokne se deadlock prevent hota hai.
(d) TRUE – Safe state ka matlab hi safe sequence exist karta hai.
[2026 (Set-1) : 1 M]
Question3.18: Consider a system consisting of K instances of a resource R, being shared by 5 processes. Assume that each process requires a maximum of two instances of resource R and a process can request or release only one instance at a time. Further, a process can request the second instance of the resource only after acquiring the first instance. The minimum value of K for the system to be deadlock-free is ?
Answer: 6
Reason:
Max per process = 2.
Worst case me 5 processes ko 1-1 instance de do = 5 instances lage.
Agar K=5 hai to sab 1 hold karke dusre ka wait karenge, deadlock.
1 extra chahiye taki koi ek process apna 2 pura karke release kar de.
Formula: K = N(max-1)+1 = 5(2-1)+1 = 6.
[2008 : 2 M]
Question3.19: Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?
(a) In deadlock prevention, the request for resources is always granted if the resulting state is safe
(b) In deadlock avoidance, the request for resources is always granted if the resulting state is safe
(c) Deadlock avoidance is less restrictive than deadlock prevention
(d) Deadlock avoidance requires knowledge of resource requirements a priori
Answer: (a)
Reason:
Prevention me safe state check hota hi nahi hai, wo to fixed rules follow karta hai. Safe state check to Avoidance (Banker’s) me hota hai. Avoidance prevention se kam restrictive hai aur usko future requirement pehle se pata hona chahiye.
[2008 : 2 M]
Question3.20: Consider a system with 4 types of resources R1 (3 units), R2 (2 units), R3 (3 units), R4 (2 units). A non-preemptive resource allocation policy is used. At any given instance, a request is not entertained if it cannot be completely satisfied. Three processes P1, P2, P3 request the resources as follows if executed independently.
P1: t=0: req 2 R2, t=1: req 1 R3, t=3: req 2 R1, t=5: rel 1 R2 and 1 R1, t=7: rel 1 R3, t=8: req 2 R4, t=10: Finishes
P2: t=0: req 2 R3, t=2: req 1 R4, t=4: req 1 R1, t=6: rel 1 R3, t=8: Finishes
P3: t=0: req 1 R4, t=2: req 2 R1, t=5: rel 2 R1, t=7: req 1 R2, t=8: req 1 R3, t=9: Finishes
Which one of the following statements is TRUE if all three processes run concurrently starting at time t=0?
(a) All processes will finish without any deadlock
(b) Only P1 and P2 will be in deadlock
(c) Only P1 and P3 will be in a deadlock
(d) All three processes will be in deadlock
Answer: (a) All processes will finish without any deadlock
Reason:
t=0 par P1 ko 2 R2, P2 ko 2 R3, P3 ko 1 R4 mil jayega. Total resources se check karne par koi circular wait banta hi nahi. Sab apne time par release kar dete hain to koi deadlock nahi.
[2010 : 2 M]
Question3.21: A system has n resources R0 to Rn-1, and k processes P0 to Pk-1. Implementation of resource request logic of each process Pi is as follows:
if (i%2==0) { if (i < n) request Ri; if (i+2 < n) request Ri+2; }
else { if (i < n) request Rn-i; if (i+2 < n) request Rn-i-2; }
In which one of the following situations is a deadlock possible?
(a) n=40, k=26 (b) n=21, k=12 (c) n=20, k=10 (d) n=41, k=19
Answer: (b) n=21, k=12
Reason:
Even process aage se aur odd process piche se resource mangta hai. Jab n chhota aur k bada hoga to dono taraf se same resource par wait banega. n=21, k=12 me P10 aur P11 dono R10 par deadlock bana denge.
[2014 Set-1 : 2 M]
Question3.22: An operating system uses Banker’s algorithm for deadlock avoidance when managing allocation of three resource types X, Y, Z to three processes P0, P1, P2. Allocation: P0(0,0,1) P1(3,2,0) P2(2,1,1), Max: P0(8,4,3) P1(6,2,0) P2(3,3,3), Available: X=3, Y=2, Z=2. System is currently in safe state. Consider independent requests:
REQ1: P0 requests 0,0,2
REQ2: P1 requests 2,0,0
Which one is TRUE?
(a) Only REQ1 can be permitted
(b) Only REQ2 can be permitted
(c) Both can be permitted
(d) Neither can be permitted
Answer: (a) Only REQ1 can be permitted
Reason:
Need = Max-Allocation. REQ1 ke baad Available (3,2,0) bachega aur safe sequence P1->P2->P0 mil jayega. REQ2 ke baad Available (1,2,2) hoga jisme system unsafe ho jayega, safe sequence nahi milega.
[2015 Set-2 : 1 M]
Question3.23: Consider following policies for preventing deadlock:
I. Processes should acquire all their resources at beginning. If any resource not available, all acquired so far are released.
II. Resources are numbered uniquely, and processes are allowed to request only in increasing resource numbers
III. Resources are numbered uniquely, and processes are allowed to request only in decreasing resource numbers
IV. Resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources
Which can be used for preventing deadlock?
(a) Any one of I and III but not II or IV
(b) Any one of I, III and IV but not II
(c) Any one of II and III but not I or IV
(d) Any one of I, II, III and IV
Answer: (d) Any one of I, II, III and IV
Reason:
I se Hold and Wait khatam hota hai. II, III, IV sab Circular Wait ko rokte hain kyunki ordering fix kar dete hain, increasing ho ya decreasing.
[2017 Set-2 : 1 M]
Question3.24: A system shares 9 tape drives. Current allocation and maximum requirement are:
P1: Current 3, Max 7
P2: Current 1, Max 6
P3: Current 3, Max 5
Which best describes current state?
(a) Safe, Deadlocked (b) Safe, Not Deadlocked (c) Not Safe, Deadlocked (d) Not Safe, Not Deadlocked
Answer: (b) Safe, Not Deadlocked
Reason:
Allocated = 7, Total = 9, Available = 2. Need P1=4, P2=5, P3=2. Available 2 se P3 finish ho jayega, 3 release karega to Available 5 ho jayega, phir P1 aur P2 finish ho jayenge. Sequence P3->P1->P2 safe hai.
[2018 : 1 M]
Question3.25: Consider a system with 3 processes that share 4 instances of same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is ?
Answer: 2
Reason:
Agar K=2 hai to worst case me har ko 1-1 dekar bhi 1 bacha rahega jisse ek process complete ho jayega. K=3 par sab 1-1 hold karke deadlock kar sakte hain.
[2018 : 2 M]
Question3.26: In a system, there are three types of resources: E, F and G. Four processes P0, P1, P2 and P3 execute concurrently. Allocation: P0(1,0,1) P1(1,1,2) P2(1,0,3) P3(2,0,0) Max: P0(4,3,1) P1(2,1,4) P2(1,3,3) P3(5,4,1). 3 instances of E and 3 instances of F are the only resources available. Which is true?
(a) The system is in safe state (b) The system is not in safe state, but would be safe if one more instance of E were available (c) The system is not in safe state, but would be safe if one more instance of F were available (d) The system is not in safe state, but would be safe if one more instance of G were available
Answer: (a) The system is in safe state
Reason:
Available (3,3,0). Need P2 (0,3,0) ko pura kar sakte hain. P2 ke finish par Available (4,3,3) ho jayega, phir P1->P0->P3 safe sequence hai.
[2020 : 1 M]
Question3.27: Consider following statements:
I. Circular wait condition is necessary for deadlock formation.
II. In a system where each resource has more than one instance, a cycle in wait-for graph indicates presence of a deadlock.
III. If current allocation leads to unsafe state then deadlock will necessarily occur.
Which is/are TRUE?
Answer: Only I is TRUE
Reason:
Circular wait 4 necessary conditions me se ek hai to I true. II false kyunki multiple instances me cycle hone par bhi deadlock zaroori nahi. III false kyunki unsafe ka matlab deadlock possible hai, necessary nahi.
[2022 : 1 M]
Question3.28: In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.
Answer: TRUE
Reason:
Assignment edge Resource->Process hoti hai. Agar sirf assignment edges hain to koi request/wait edge hi nahi hai, to deadlock kaise hoga.
[2025 Set-2 : 2 M]
Question3.29: P={P1,P2,P3,P4} consists of all active processes and R={R1,R2,R3,R4} consists of single instances of distinct types of resources. Assignment edges: R1->P1, R2->P2, R3->P3, R4->P4. Claim edges: P1->R2, P2->R3, P3->R1, P2->R4, P4->R2. Which statement(s) is/are CORRECT?
(a) Aborting P1 makes deadlock free (b) Aborting P2 makes deadlock free (c) Aborting P3 makes deadlock free (d) Aborting P1 and P4 makes deadlock free
Answer: (d)
Reason:
Cycle1: P1->R2->P2->R3->P3->R1->P1, Cycle2: P2->R4->P4->R2->P2. Sirf ek process abort karne se dusra cycle bacha rahega. P1 aur P4 dono abort karne par dono cycles toot jayenge.
[2026 Set-1 : 1 M]
Question3.30: With respect to deadlocks, which statements is/are FALSE?
(a) Banker’s algorithm is used to prevent deadlocks
(b) Deadlock formation can be prevented by ensuring hold and wait is not allowed
(c) An assignment edge in resource allocation graph is marked from a process to a resource
(d) A safe state guarantees that all processes can finish without deadlock
Answer: (a) and (c) are FALSE
Reason:
(a) Banker avoidance ke liye hai, prevention ke liye nahi. (c) Assignment Resource->Process hoti hai, Process->Resource to request hoti hai.
[2026 Set-1 : 1 M]
Question3.31: Consider a system consisting of K instances of a resource R, being shared by 5 processes. Each process requires max two instances and can request or release only one at a time. Further, a process can request second instance only after acquiring first. Minimum value of K for system to be deadlock-free is ?
Answer: 6
Reason:
Formula: K = N(max-1)+1 = 5(2-1)+1 = 6. 5 processes ko 1-1 dekar bhi 1 extra bachega to deadlock nahi hoga.
