CS FundamentalsVery hardGATE CS · Advanced

A system with 3 resource types has Available = (0, 0, 1) and 7 processes P0-P6. P0: Allocation (1, 1, 1), Request (1, 0, 0); P1: Allocation (0, 0, 1), Request (0, 0, 2); P2: Allocation (0, 2, 1), Request (0, 0, 0); P3: Allocation (1, 1, 0), Request (1, 0, 2); P4: Allocation (2, 0, 0), Request (2, 0, 0); P5: Allocation (0, 1, 0), Request (2, 0, 2); P6: Allocation (0, 1, 0), Request (0, 1, 0). The deadlock-detection algorithm (repeatedly let any process whose outstanding Request fits within Work finish and release its Allocation) is run. How many processes are deadlocked?

  1. A. 3
  2. B. 5
  3. C. 4
  4. D. 6

Correct answer: C. 4

Start with Work = Available, let every process whose request fits finish and add its allocation to Work, and repeat. The processes left unfinished (P0, P3, P4, P5) are deadlocked. Merely waiting for a resource right now (6 processes) is not the same as being deadlocked.

More Operating Systems questions

Exams that ask this topic