CS FundamentalsModerateGATE CS

Two processes each need two printers, and the system has exactly 3 printers; each requests its printers one at a time and holds them until done. Can the system deadlock?

  1. A. Yes, if each holds one printer and then waits for its second
  2. B. Yes, but only once a third process also asks for a printer
  3. C. No: one of them can always get its second printer
  4. D. No, but only because printer output is spooled to disk

Correct answer: C. No: one of them can always get its second printer

The worst case is each holding one printer, using 2 of 3, so the third is free and one of them gets it and finishes. Deadlock needs at least n(k − 1) + 1 = 2 × 1 + 1 = 3 printers to be impossible, and 3 meets that.

More Operating Systems questions

Exams that ask this topic