A computer system has 7 tape drives. There are ‘n’ processes competing for…
2021
A computer system has 7 tape drives. There are ‘n’ processes competing for them. Each process may need 2 tape drives. What is the maximum value of ‘n’ for which the system is guaranteed to be deadlock free?
- A.
2
- B.
6
- C.
4
- D.
1
Attempted by 183 students.
Show answer & explanation
Correct answer: B
Concept
For a single type of resource with R identical units, suppose each of n processes may claim at most M units. The system is guaranteed deadlock-free as long as R ≥ n(M − 1) + 1. Reason: the tightest situation to break is when every process is simultaneously blocked holding (M − 1) units — one short of its maximum. Together they then hold n(M − 1) units; if the total R exceeds this, at least one unit is still free, so some process can obtain its last unit, finish, and release — and no deadlock can occur.
Application
Here R = 7 tape drives, and each process needs at most M = 2 drives, so M − 1 = 1.
Substitute into the safe condition: 7 ≥ n·(1) + 1, i.e. 7 ≥ n + 1.
Solve for n: n ≤ 6. The largest process count that keeps the system guaranteed deadlock-free is n = 6.
Cross-check
Test the boundary. With n = 6, the worst case gives each process one drive (6 in use) and leaves 1 drive free; that spare lets some process take its second drive, finish, and release both — the rest then unblock, so no deadlock. With n = 7, all seven drives could be held one-per-process with none free and every process waiting for a second drive — a genuine deadlock. Hence 6 is exactly the safe boundary, and the maximum value of n is 6.