top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

OS: Can someone please explain priority inversion through an example ?

+1 vote
434 views
OS: Can someone please explain priority inversion through an example ?
posted Jun 24, 2014 by Neelam

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Priority inversion is a situation where in lower priority tasks will run blocking higher priority tasks waiting for resource (mutex). For ex: consider 3 tasks. A, B and C, A being highest priority task and C is lowest. Look at sequence of context swaps

A goes for I/O . unlocks mutex. C was ready to run. So C starts running. locks mutex B is ready to run. Swaps out C and takes mutex. A is ready to run. but A is blocked as mutex is locked by B. but B will never relinquishes the mutex as its higher priority than C.

The solution to priority inversion is Priority inheritance.

Priority Inheritance is the solution for priority inversion. whenever a high priority task request for some
resource which is locked by a low priority task, the priority of lower task is inherited to the priority of the
higher task. The instance it unlocks the resource the prioity is changed to its original value.

Another solution for this is priority ceiling where you inherit the priority of the lower task whenever a higher task is created.Even if the higher priority task does not request for the resource

Read more at: http://tech.queryhome.com/43566/what-priority-inversion-what-are-various-methods-overcome

answer Jun 24, 2014 by Salil Agrawal
...