edited by
968 views
0 votes
0 votes
Can priority inversion be solved using sleep and wake approach and avoiding busy wait?
edited by

3 Answers

0 votes
0 votes

I'm assuming you mean sleep and wake to avoid busy wait such that there is no priority inversion.As busy wait essentially would ensure there is no priority inversion.

So to  to avoid busy wait , priority of low priority process can be changed to higher than current ; so no inversion happens.

0 votes
0 votes

NO.

Priority Inversion Problem :
Lets Consider one example: Tasks:
High Priority (H) 
Medium Priority (M)
Low Priority (L)

and a lock X, may be semaphore_lock(X).(lock is required by only L and H but M does not require this lock)

Scenario:
1. L runs and acquires X 
2. Then H tries to access X while L has it, because of semaphore, H sleeps. 
3. M arrives, pre-empts L and runs. In effect, H & M were two processes waiting to run but M ran because H was waiting on lock and couldn't run.
4. M finishes, H can't enter because L has the lock, so L runs.
5. L finishes, relinquishes the lock. Now H gets the lock and executes.

H had the highest priority but ran after the lower priority processes had run. This is Priority Inversion. 

see the story behind it:

http://research.microsoft.com/en-us/um/people/mbj/Mars_Pathfinder/Mars_Pathfinder.html

Related questions

0 votes
0 votes
2 answers
4