Difference between revisions of "Priority Inversion"
From Suhrid.net Wiki
Jump to navigationJump to search (Created page with "= Intro = * All synchronization mechanisms that are based on mutual exclusion suffer from priority inversion. * This is where a low-priority SO enters into a mutual-exclusion zo...") |
(→Intro) |
||
Line 6: | Line 6: | ||
* So the low priority SO cant run and get out of the mutex zone. Which means, the high priority thread is blocked. | * So the low priority SO cant run and get out of the mutex zone. Which means, the high priority thread is blocked. | ||
* The medium-priority thread thereby indirectly blocks the progression of the high-priority thread for a potentially unbounded period of time. | * The medium-priority thread thereby indirectly blocks the progression of the high-priority thread for a potentially unbounded period of time. | ||
+ | |||
+ | * Solutions ? | ||
+ | ** Priority Inheritance | ||
+ | ** Non Blocking Communication | ||
+ | |||
+ | = Priority Inheritance = | ||
+ | |||
+ | * If thread p is blocking thread q, then p runs with q's priority. | ||
+ | |||
+ | == RTSJ Model == | ||
+ | |||
+ | * RTSJ requires all system Q's to be priority ordered. | ||
+ | ** Q's of SO's waiting for an object lock. | ||
+ | ** SO's blocked on wait(). | ||
+ | * If more than one SO in the Q has same priority, then FIFO is followed. | ||
+ | * Has facilities to specify priority inversion control algorithms. | ||
+ | ** By default, RTSJ requires simple priority inheritance to occur whenever a SO is blocked waiting for a resource. | ||
[[Category:RealtimeJava]] | [[Category:RealtimeJava]] |
Revision as of 17:17, 6 January 2012
Intro
- All synchronization mechanisms that are based on mutual exclusion suffer from priority inversion.
- This is where a low-priority SO enters into a mutual-exclusion zone which it shares with a high-priority SO.
- Now the low priority SO is in a mutex zone. Now, consider a medium priority thread which doesnt use the mutex zone, it preempts the low priority thread and starts performing a computationally intensive task.
- So the low priority SO cant run and get out of the mutex zone. Which means, the high priority thread is blocked.
- The medium-priority thread thereby indirectly blocks the progression of the high-priority thread for a potentially unbounded period of time.
- Solutions ?
- Priority Inheritance
- Non Blocking Communication
Priority Inheritance
- If thread p is blocking thread q, then p runs with q's priority.
RTSJ Model
- RTSJ requires all system Q's to be priority ordered.
- Q's of SO's waiting for an object lock.
- SO's blocked on wait().
- If more than one SO in the Q has same priority, then FIFO is followed.
- Has facilities to specify priority inversion control algorithms.
- By default, RTSJ requires simple priority inheritance to occur whenever a SO is blocked waiting for a resource.