Skip to content
Official PYQ · 1998

GATE CS 1998 Q1.32 — Deadlock

Explain with AI

A computer has six tape drives, with nn processes competing for them. Each process may need two drives. What is the maximum value of nn for the system to be deadlock free?

Choose one option
View worked solution

Answer: B

To ensure the system is guaranteed to be deadlock-free, we analyze the worst-case resource allocation scenario.

Let:

  • R=6R = 6 (total number of tape drives available)
  • nn = number of processes
  • Maxi=2Max_i = 2 (maximum demand of each process ii)

In the worst-case scenario, each process is allocated one less than its maximum requirement, meaning each process holds exactly Maxi−1=2−1=1Max_i - 1 = 2 - 1 = 1 tape drive and is waiting for one more.

The total number of allocated drives in this state is:

∑i=1n(Maxi−1)=n×(2−1)=n\sum_{i=1}^{n} (Max_i - 1) = n \times (2 - 1) = n

For a deadlock to be impossible, the total number of resources RR must be strictly greater than this worst-case allocation, ensuring at least one process can get its remaining required resource and run to completion:

R>n×(Maxi−1)R > n \times (Max_i - 1) 6>n×16 > n \times 1 n<6n < 6

Since nn must be an integer, the maximum value of nn for the system to remain deadlock-free is 55.

Verification:

  • If n=5n = 5, each process holds 11 drive (total 55 allocated). The 11 remaining free drive can be allocated to any process, allowing it to finish and release its resources.
  • If n=6n = 6, each process holds 11 drive (total 66 allocated). No free drives remain, resulting in a deadlock.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Deadlock questions