IAE Academy

ISRO CS 2023 Q.49: solution and answer

ISRO 2023 · CSQ.49 · 1 mark · MCQ

Purpose of priority inheritance protocol in synchronization mechanisms is

  1. (A)

    To prevent priority inversion in systems having two or lesser priorities for a resource

  2. (B)

    To provide mutual exclusion between threads and prevent data corruption

  3. (C)

    To prevent priority inversion and ensure fairness in resource allocation

  4. (D)

    To allow multiple threads to access any resource simultaneously

See the question in the paper

Answer and solution

ANSWER

The purpose of the priority inheritance protocol is to prevent priority inversion and to keep resource allocation from being dominated by unrelated middle-priority tasks, which is option (c).

Official answer: CSource: ISRO's revised and final answer key of 16 February 2024

  1. Priority inversion: a high-priority task waits for a lock held by a low-priority task. If a medium-priority task preempts the low-priority holder, the high-priority task is delayed for an unbounded time by a task it does not even share the resource with.

  2. Priority inheritance: while a low-priority task holds a lock that a higher-priority task is waiting for, it temporarily runs at the waiter's priority. The medium-priority task can then no longer preempt it, so it finishes its critical section sooner, releases the lock and returns to its own priority.

  3. So the protocol exists to prevent (bound) priority inversion and to let the resource reach the task that actually needs it, instead of being held up by unrelated middle-priority tasks. Option (c) states this purpose: preventing priority inversion and a fairer allocation of the resource.

  4. Option (a) limits the protocol to systems with two or fewer priority levels. Unbounded inversion needs at least three levels (high, medium, low), so this describes the wrong setting.

  5. Option (b) describes what a mutex or lock does. Priority inheritance adds nothing to mutual exclusion itself; it only adjusts priorities while a lock is held.

  6. Option (d) describes unrestricted simultaneous access, the opposite of a lock-based protocol.

  7. Hence (c) is the best option.

KEY IDEA

A lock holder temporarily inherits the priority of the highest-priority task waiting for the lock, so a medium-priority task cannot preempt it and delay the waiter indefinitely.

WATCH OUT FOR

Choosing (b) because locks are involved. Mutual exclusion is the job of the lock itself; priority inheritance deals only with the scheduling problem (priority inversion) that a lock can create.

From the ISRO CS 2023 paper. Every question of this paper · The full paper (PDF, ISRO) · All 3 ISRO Synchronisation questions, with notes