CS FundamentalsVery hardGATE CS (PYQ pattern)

Fixed priorities H > M > L, preemptive, one CPU. L arrives at 0: computes 2 ms, locks mutex m, computes 4 ms, unlocks, computes 1 ms. M arrives at 3 and computes 6 ms (never uses m). H arrives at 4: computes 1 ms, locks m, computes 2 ms, unlocks, computes 1 ms. At what time does H finish without priority inheritance, and with it (L inherits H's priority while H is blocked on m)?

  1. A. 17 ms and 11 ms
  2. B. 16 ms and 11 ms
  3. C. 16 ms and 13 ms
  4. D. 16 ms and 10 ms

Correct answer: B. 16 ms and 11 ms

Without inheritance: L 0-3 (locks at 2), M 3-4, H 4-5 then blocks on m, M runs 5-10, L finishes its critical section 10-13, H 13-16. With inheritance: same until 5, then L runs at H's priority 5-8 and unlocks, H runs 8-11; M only resumes at 11. M's 5 ms after H blocks is exactly the inversion that inheritance removes.

More Operating Systems questions

Exams that ask this topic