What is priority inversion?

Answer Posted / venkatgopu

Priority inversion is a situation where in lower priority
tasks will run blocking higher priority tasks waiting for
resource (mutex).

priority: A(High) B(Medium) C(Low)

C was ready to run. So C starts running. locks mutex

A is ready to run. Bcz of A is higher priority than C, A
gets the CPU (otherwords C relinguishes CPU).
While executing "A" task, it's need of resource(mutex) but
it locked by lower priority task "C". so task "A" going to
be waiting state(priority inversion)

B is ready to run. Bcz B is Higher priority than C, B get
the CPU frm C.

For task "B", its no need of any resource(mutex). so it
wont be waiting for any task to get resource. it will be
finished first.

Then, Task "C" gets CPU from task "B" and finished its
task, and reliese the resource(mutex).

Task C (waiting task for resource)then gets mutex finish
execution..

Here:

B(M) task finished exe first
C(L) task finished exe second
A(H) task finished exe last even its have higher priority
than both B and C

The solution to priority inversion is Priority inheritance

Is This Answer Correct ?    35 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category