CS FundamentalsHardGATE CS
Priority inversion: low-priority L holds a mutex needed by high-priority H, and medium-priority M (which does not need the mutex) keeps preempting L. Which protocol bounds H's blocking to the length of L's critical section?
- A. Giving M a time quantum
- B. Aging H's priority upward
- C. Making the mutex a spinlock
- D. Priority inheritance: L temporarily runs at H's priority while holding the mutex
Correct answer: D. Priority inheritance: L temporarily runs at H's priority while holding the mutex
Raising L to H's priority prevents M from preempting L, so L finishes its critical section quickly and releases the mutex. This was the fix applied on the Mars Pathfinder lander.
More Operating Systems questions
- Which property distinguishes a mutex from a binary semaphore in most implementations?
- A spinlock is held for about 50 ns on average, and a context switch costs about 5 µs. On a multicore machine, which is better for a thread…
- compareandswap(&v, expected, new) atomically sets v = new only if v == expected and returns the old value. A lock-free increment is…
- Which condition makes disabling interrupts an INSUFFICIENT way to implement a critical section?
- Two threads run on different cores. Thread 1: data = 42; ready = 1; Thread 2: while (!ready); print(data); Both variables are plain…
- How many of these statements about the critical-section problem are correct? 1. Progress means only processes not in their remainder…