Real Time Systems: Notes

Priorities and Mutual Exclusion

 

These notes make use of mathematical symbols that may not be visible with the default settings on some versions of some browsers.

SymbolSymbol NameSymbolSymbol NameSymbolSymbol Name
simsumlceil
rceillfloorrfloor
rarrrArrinfin
<ltle>gt
geneδdelta
ΔDeltapartτtau
πpiφphiinfin

If a blank space appears to the left of any of the names in the table above, or the symbol looks strange, try changing the font settings on your browser or using a different browser.

Warning: All of the discussion here is based on a single-processor environment, where the blocking task and the blocked task are competing for the same (single) processor.

Blocking, a.k.a. Priority Inversion

Priority Inversion Example

figure

In this example, task τ1 si blocked by tasks τ2 and τ3.

Note that the problem here is not just priority inversion. It is inevitable that τ3 block τ1 until the critical section is complete, in order to preserve mutual exclusion. We expect critical sections to be short, so the duration of this blocking should be very short.

The problem is the the priority inversion caused by &tau2;, which is potentially unbounded, since &tau2; is not inside a critical section.

In general, we use the term Bi to denote the maximum length of time that task τi can be blocked. The figure shows that this term can be very large, unless we do something to prevent the kind of "pass through" blocking inflicted on τ1 by τ2 here.

Adding Blocking terms to Fixed-Task_Priority Schedulability Analysis

If Bk is the worst-case blocking time experienced by task τk, then τk is schedulable by preemptive RM in collection of independent periodic tasks τ1,...,τn if

Bk/pk + k

i=1
ei/pi ≤ m(21/m-1)

Adding the blocking term to the response time equation gives us the following:

t = ek + Bk +
k-1

i = 1
t
pi
ei

... and similary for the EDF analysis.

Priority Inheritance

Immediate Priority Ceiling Protocol (ICPP), aka Highest-Locker-Priority and SRP

Warning: Do not confuse this with the "Priority Ceiling Protocol" (PCP), which uses priority ceilings in a more complicated and subtle way.


The above protocol is a simplification of a more general treatment, which I published under the name "Stack Resource Protocol". The SRP handles reader-writere and mult-unit resources as well as mutexes, and works for both EDF and fixed-task-priority scheduling. It also works for a very lightweight task model, in which threads share a single runtime stack.

An Extreme Case: Nonpreemption

Original Priority Ceiling Protocol (PCP)

See SEI notes on priority inversion and synchronization for some good examples and figures.

T. P. Baker. ($Id$)