Difference between revisions of "Priority Inversion"

From Suhrid.net Wiki
Jump to navigationJump to search
Line 24: Line 24:
 
** By default, RTSJ requires simple priority inheritance to occur whenever a SO is blocked waiting for a resource.
 
** By default, RTSJ requires simple priority inheritance to occur whenever a SO is blocked waiting for a resource.
  
 +
* There is a class called javax.realtime.MonitorControl which specifies the monitor priority control Policy.
 +
* The PriorityInheritance class extends the MonitorControl class.
  
 
[[Category:RealtimeJava]]
 
[[Category:RealtimeJava]]

Revision as of 17:18, 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.
  • There is a class called javax.realtime.MonitorControl which specifies the monitor priority control Policy.
  • The PriorityInheritance class extends the MonitorControl class.