Which of the following is not one of the four necessary conditions for deadlock?
Q2
A resource-allocation graph contains a cycle, and every resource type has exactly one instance. What can you conclude?
Q3
A resource-allocation graph contains a cycle, but one resource type in the cycle has two instances, and the second instance is held by a process outside the cycle that is not waiting for anything. What can you conclude?
Q4
Requiring every process to request all its resources at once before starting prevents deadlock by breaking which condition?
Q5
A team decides: "every thread must acquire locks in increasing order of lock ID". Which condition does this break?
Q6
Why do Linux and Windows mostly ignore deadlocks among user processes (the "ostrich approach")?
Q7
In the Banker's algorithm, how is the Need matrix computed?
Q8
Which statement about safe and unsafe states is correct?
Q9
EdgeCampus state (resources GPU, CPU, MEM): Available = (2, 3, 4); Need P0 = (3 3 6), P1 = (1 3 4), P2 = (2 1 6), P3 = (2 3 4); Allocation P0 = (1 1 2), P1 = (1 0 2), P2 = (1 1 2), P3 = (0 2 0). Scanning P0…P3 in passes, what safe sequence do you find?
Q10
Same EdgeCampus state. P0 requests (1 1 2), which is currently available. What does the Banker's algorithm do?
Q11
Process P3 has Max = (2 2 2) and Allocation = (2 1 1). It requests (1 0 0). What happens?
Q12
Why is the Banker's algorithm rarely used directly in general-purpose operating systems?
Q13
Three processes share 4 identical GPU slots; each process needs at most 2 slots at a time, and holds slots while waiting for more. Can a deadlock occur?
Q14
With the detection algorithm (current Request instead of Need), a process that holds no resources is marked finished at the start. Why?
Q15
A database finds a deadlock between transactions T1 (running for 2 s, updated 3 rows) and T2 (running for 40 s, updated 5,000 rows). Which victim is usually chosen?
Q16
Two threads repeatedly detect a conflict, both release their locks, wait the same fixed time and retry — forever. What is this, and a fix?
Q17
A high-priority task waits for a lock held by a low-priority task, which is preempted by a medium-priority task. Is this a deadlock?
Q18
Two 6-GPU training jobs are scheduled pod-by-pod on an 8-GPU cluster, alternating pods. What happens, and which technique prevents it?
Q19
Why do distributed systems often prefer timeouts and leases to exact deadlock detection?
Q20
In a wait-for graph, the edge P1 → P2 means:
Q21
Which Java practice most directly prevents lock-ordering deadlocks between transfer(a, b) and transfer(b, a)?
For each technique, say which deadlock condition it attacks and give one practical drawback: (a) spooling printer jobs; (b) acquiring all locks at the start of a transaction; (c) taking the CPU away from a process; (d) global lock ordering; (e) gang scheduling of GPU jobs.
Q30Short answer
A Java service hangs. jstack <pid> prints: "Found one Java-level deadlock: Thread-A waiting to lock <0x1> (Order) which is held by Thread-B; Thread-B waiting to lock <0x2> (Inventory) which is held by Thread-A." Draw the wait-for graph, explain how the deadlock arose, and propose two fixes.