In
real-time computing
Real-time computing (RTC) is the computer science term for hardware and software systems subject to a "real-time constraint", for example from event to system response. Real-time programs must guarantee response within specified time constra ...
, priority inheritance is a method for eliminating unbounded
priority inversion
In computer science, priority inversion is a scenario in scheduling in which a high priority task is indirectly superseded by a lower priority task effectively inverting the assigned priorities of the tasks. This violates the priority model that h ...
. Using this
programming method, a
process scheduling
In computing, scheduling is the action of assigning ''resources'' to perform ''tasks''. The ''resources'' may be processors, network links or expansion cards. The ''tasks'' may be threads, processes or data flows.
The scheduling activity is car ...
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
increases the priority of a process (A) to the maximum priority of any other process waiting for any
resource
Resource refers to all the materials available in our environment which are technologically accessible, economically feasible and culturally sustainable and help us to satisfy our needs and wants. Resources can broadly be classified upon their av ...
on which A has a
resource lock (if it is higher than the original priority of A).
The basic idea of the priority inheritance protocol is that when a job blocks one or more high-priority jobs, it ignores its original priority assignment and executes its
critical section
In concurrent programming, concurrent accesses to shared resources can lead to unexpected or erroneous behavior, so parts of the program where the shared resource is accessed need to be protected in ways that avoid the concurrent access. One way ...
at an elevated priority level. After executing its critical section and releasing its locks, the process returns to its original priority level.
Example
Consider three jobs:
Suppose that both H and L require some shared resource. If L acquires this shared resource (entering a critical section), and H subsequently requires it, H will block until L releases it (leaving its critical section). Without priority inheritance, process M could
preempt
Preempt (also spelled "pre-empt") is a bid in contract bridge whose primary objectives are (1) to thwart opponents' ability to bid to their best contract, with some safety, and (2) to fully describe one's hand to one's partner in a single bid. A ...
process L during the critical section and delay its completion, in effect causing the lower-priority process M to indirectly preempt the high-priority process H. This is a
priority inversion
In computer science, priority inversion is a scenario in scheduling in which a high priority task is indirectly superseded by a lower priority task effectively inverting the assigned priorities of the tasks. This violates the priority model that h ...
bug.
With priority inheritance, L will execute its critical section at H's high priority whenever H is blocked on the shared resource. As a result, M will be unable to preempt L and will be blocked. That is, the higher-priority job M must wait for the critical section of the lower priority job L to be executed, because L has inherited H's priority. When L exits its critical section, it regains its original (low) priority and awakens H (which was blocked by L). H, having high priority, preempts L and runs to completion. This enables M and L to resume in succession and run to completion without priority inversion.
Operating systems supporting priority inheritance
*
FreeRTOS
FreeRTOS is a real-time operating system kernel for embedded devices that has been ported to 35 microcontroller platforms. It is distributed under the MIT License.
History
The FreeRTOS kernel was originally developed by Richard Barry around 20 ...
*
Microsoft Azure RTOS, formerly Express Logic's ThreadX
*
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
*
VxWorks
VxWorks is a real-time operating system (or RTOS) developed as proprietary software by Wind River Systems, a wholly-owned subsidiary of Aptiv. First released in 1987, VxWorks is designed for use in embedded systems requiring real-time, dete ...
See also
*
Priority ceiling protocol In real-time computing, the priority ceiling protocol is a synchronization protocol for shared resources to avoid unbounded priority inversion and mutual deadlock due to wrong nesting of critical sections. In this protocol each resource is assigned ...
References
*
External links
*
Priority Inheritance: The Real Story by
Doug Locke
Doug Locke is an American singer, songwriter, actor, model and host. As a recording artist, he is also sometimes known mononymously as Locke. Locke was born in Houston, Texas to Gene and Aubrey Locke.
Early life and education
Locke is the son ...
*
Against Priority Inheritance by
Victor Yodaiken
*
Implementing Concurrency Control With Priority Inheritance in Real-Time CORBA by
Steven Wohlever,
Victor Fay Wolfe and Russell Johnston
*
Priority Inheritance Spin Locks for Multiprocessor Real-Time Systems by
Cai-Dong Wang,
Hiroaki Takada and
Ken Sakamura
Ken or KEN may refer to:
Entertainment
* ''Ken'' (album), a 2017 album by Canadian indie rock band Destroyer.
* ''Ken'' (film), 1964 Japanese film.
* ''Ken'' (magazine), a large-format political magazine.
* Ken Masters, a main character in ...
*
Hardware Support for Priority Inheritance by
Bilge E. S. Akgul
The bilge of a ship or boat is the part of the hull that would rest on the ground if the vessel were unsupported by water. The "turn of the bilge" is the transition from the bottom of a hull to the sides of a hull.
Internally, the bilges (usu ...
,
Vincent J. Mooney
Vincent ( la, Vincentius) is a male given name derived from the Roman name Vincentius, which is derived from the Latin word (''to conquer'').
People with the given name Artists
*Vincent Apap (1909–2003), Maltese sculptor
*Vincent van Gogh ...
,
Henrik Thane and
Pramote Kuacharoen
Real-time computing
Concurrency control
{{compu-sci-stub