Priority inversion

From RTwiki
(Difference between revisions)
Jump to: navigation, search
m
m
 
Line 1: Line 1:
 
Priority inversion can occur as follows:
 
Priority inversion can occur as follows:
* A low-priority process acquires a lock.
+
* A low-priority task acquires a lock.
* This low-priority process is preempted by a medium-priority process.
+
* This low-priority task is preempted by a medium-priority task.
* A high-priority process attempts to acquire the lock held by the preempted low-priority process.
+
* A high-priority task attempts to acquire the lock held by the preempted low-priority task.
The high-priority process cannot run until the low-priority process releases the lock, which will not happen as long as the medium priority process continues to run.  The medium-priority process is thus effectively preventing the high-priority process from running, hence the name "priority inversion".
+
The high-priority task cannot run until the low-priority task releases the lock, which will not happen as long as the medium priority task continues to run.  The medium-priority task is thus effectively preventing the high-priority task from running, hence the name "priority inversion".
Priority inversion can be prevented via [[priority inheritance]], by disabling preemption for any process holding a lock, by associating a priority with each lock (boosting any holding process to the lock's priority, which must be at least as high as any process acquiring it) or by prohibiting processes of different priorities from acquiring the same lock.
+
Priority inversion can be prevented via [[priority inheritance]], by disabling preemption for any task holding a lock, by associating a priority with each lock (boosting any holding task to the lock's priority, which must be at least as high as any task acquiring it) or by prohibiting tasks of different priorities from acquiring the same lock.
  
 
CONFIG_PREEMPT_RT uses [[priority inheritance]].
 
CONFIG_PREEMPT_RT uses [[priority inheritance]].
  
 
[[Category:Glossary]]
 
[[Category:Glossary]]

Latest revision as of 10:26, 10 October 2006

Priority inversion can occur as follows:

  • A low-priority task acquires a lock.
  • This low-priority task is preempted by a medium-priority task.
  • A high-priority task attempts to acquire the lock held by the preempted low-priority task.

The high-priority task cannot run until the low-priority task releases the lock, which will not happen as long as the medium priority task continues to run. The medium-priority task is thus effectively preventing the high-priority task from running, hence the name "priority inversion". Priority inversion can be prevented via priority inheritance, by disabling preemption for any task holding a lock, by associating a priority with each lock (boosting any holding task to the lock's priority, which must be at least as high as any task acquiring it) or by prohibiting tasks of different priorities from acquiring the same lock.

CONFIG_PREEMPT_RT uses priority inheritance.

Personal tools