What is priority inversion?

Answer Posted / sriniv

Take three tasks A,B and C.

A - High.
B - Medium.
C - Low.

C is scheduled and running and locks a resource which is
shared with A. Now B is scheduled and taked the CPU time so
it starts running keeping C in wait state.

Now A is scheduled which is the higher priority task than B
and C and gets the CPU time and it starts running. But it
needs the shared resource which is locked by task C. So A
waits for that resource.

Now CPU starts servicing task B as it has higher priority
than C. A is suppose to wait till task B is finished even
though it has highest priority than B. To avoid this
situation exchange the priority levels of A and C. After
this C will become highest priority and gets the CPU time
by suspending task B. Task C will be serviced and releases
resource shared with task A. As soon as task C is released
the shared resource change the prority levels of A and C
again. Now A will become highest priority than C and CPU
starts running Task A.

This is called Proirity inversion.

Is This Answer Correct ?    12 Yes 2 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