RTUComputer ScienceYr 2020 · Sem 82020

Q13Real Time Systems

Question

4 marks

Discuss the Priority Inheritance Protocol (PIP) and explain how it solves the priority inversion problem.

Answer

A critical mathematical exposition on the Priority Inheritance Protocol (PIP). Details how it violently forces low-priority tasks blocking critical resources to temporarily inherit maximum priority, annihilating the catastrophic Priority Inversion problem.

In a preemptive RTS, a horrific architectural failure called Priority Inversion can occur when tasks share data.

  • 1. Task L (Low priority) mathematically locks a Mutex to write to a shared database.
  • 2. Task H (High priority) becomes ready, violently preempts Task L, and begins executing.
  • 3. Task H tries to lock the exact same Mutex. It is blocked, so Task H mathematically goes to sleep, waiting for Task L to finish.
  • 4. Task M (Medium priority) becomes ready. Since Task H is asleep, Task M violently preempts Task L.
  • The Result: Task M is now mathematically preventing Task L from releasing the lock. Therefore, Task M is effectively blocking Task H from running. A Medium task has hijacked a High task. If this continues, Task H will catastrophically miss its deadline.

PIP executes a brilliant, dynamic mathematical hack on the OS scheduler.

  • When Task H attempts to grab the Mutex and discovers it is locked by Task L, the OS violently intervenes.
  • The OS mathematically elevates Task L's priority to exactly match Task H's priority (Task L inherits the priority).
  • Now, when Task M becomes ready, it mathematically CANNOT preempt Task L, because Task L is currently running at High Priority.
  • Task L rapidly finishes its database write, releases the Mutex, and instantly loses its inherited priority, dropping back to Low.
  • Task H instantly grabs the Mutex and violently resumes execution, completely destroying the Priority Inversion trap.
Back to Paper