You are on page 1of 22

# A presentation for

Brian Evans’
Embedded Software Class

By Nate Forman
Liaison Technology Inc.
For Real-Time Scheduling 3/30/2000
Agenda

• Introduction
• Rate Monotonic
Principles and Tests
• Extended Rate Monotonic
Analysis
• Demonstration
• Mars Pathfinder Mission

Introduction

## • Rate Monotonic refers to assigning priorities as a monotonic

function of the rate (frequency of occurrence) of those
processes.

## • Rate Monotonic Scheduling (RMS) can be accomplished

based upon rate monotonic principles.

## • Rate Monotonic Analysis (RMA) can be performed statically

on any hard real-time system concept to decide if the system
is schedulable.

τ 1

τ 2

τ 3

time

## 3/2000 Rate Monotonic Analysis, Nate Forman

Rate Monotonic Assumptions

## • Tasks account for all processor execution time

beginning of their periods and relinquish the CPU only
when execution is complete

## 3/2000 Rate Monotonic Analysis, Nate Forman

Rate Monotonic Assumptions (2)

## • Tasks with shorter periods are assigned higher priorities;

no other criteria are considered for priority assignment

## • Task execution is always consistent with rate monotonic

priority: a lower priority task never executes when a

## 3/2000 Rate Monotonic Analysis, Nate Forman

Utilization Bound (UB) Test

Ci
Processor Utilization for a task, i Ui =
Ti
1
Utilization Bound for n tasks U(n) = n(2 n
- 1)

Results:
• If Σ Ui ≤ U(n) then the set of tasks is schedulable.
• If Σ Ui > 1 then the set of tasks is unschedulable.
• If U(n) < Σ Ui ≤ 1 then the test is inconclusive.

UB Test Example
(C)
τ 1 40 100
τ 2 40 150
τ 3 100 350

## U2 = 40 / 150 = 0.267 Result:

U3 = 100 / 350 = 0.286 U1+2 = 0.667, schedulable.
However, 0.779 < 0.953 < 1
Utotal = 0.953 Therefore, inconclusive for τ 3.
3/2000 Rate Monotonic Analysis, Nate Forman
Response Time (RT) Test

phasing, that deadline will always be met.

For the response time for task i, find the least fixed-point of the
following recurrence:

an
a0 = Σ Cj an+1 = Ci + Σ Cj
j ∈ H + {i} j∈H
Tj

## 3/2000 Rate Monotonic Analysis, Nate Forman

RT Test Example
(C)
τ 1 40 100
τ 2 40 150
τ 3 100 350

a0 = Σ Cj = 40 + 40 + 100 = 180
j ∈ H + {i}
a2 = a3 = 300
180
a1 = C3 + Σ Cj = 100 + (2 * 40) + (2 * 40) = 260
Tj
300 < τ = 350
j∈H

3
260
a2 = C3 + Σ Cj = 100 + (3 * 40) + (2 * 40) = 300
j∈H Tj τ 3 is schedulable.
300
a3 = C3 + Σ Cj = 100 + (3 * 40) + (2 * 40) = 300
j∈H Tj

## 3/2000 Rate Monotonic Analysis, Nate Forman

Extensions to RMA

## • Task blocking and interaction through shared resources

(Bi = blocking time for task i)
3/2000 Rate Monotonic Analysis, Nate Forman

## • Its execution budget is only replenished after a period

where it is completely consumed instead of after every
period’s end.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Priority Inversion

## • A high priority task is ready to execute, but a lower

priority task continues execution because it holds a lock
on a shared resource that the high priority task needs.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Priority Inversion (2)

## • To successfully share resources, a system needs two

properties: freedom from mutual deadlock, and bounded
priority inversion.

## • The combination of priority inheritance and the priority

ceiling protocol guarantee the above properties.

## Priority Inheritance: When a task blocks the execution

of other, higher priority tasks, it executes at the highest
priority of all of the tasks it blocks.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Priority Ceiling Protocol

## • Priority Ceiling: of a binary semaphore is the highest

priority of all of the tasks that may lock it.

## • A task attempting to a execute critical section is blocked

unless its priority is higher than the priority ceilings of
all of the locked semaphores in the system.

## • The task holding the lock on the highest priority ceiling

semaphore inherits the priorities of tasks blocked in this
way.

Extended UB Test

U(n, ∆ i) =
∆ i, ∆ i ≤ 0.5

## 3/2000 Rate Monotonic Analysis, Nate Forman

Extended UB Test (2)

## Updated processor utilization:

Cj + 2S Ci + 2S Bi 1
fi = Σ + + + Σ∈ H1 (Ck + 2S)
j ∈ Hn
Tj Ti Ti Ti k

where Hn is the set of higher priority tasks that can preempt task i
more than once (shorter periods) and H1 are higher priority tasks
that can preempt task i only once (longer periods)

Compare each fi to its utilization bound, U(n, ∆ i). The results can
be interpreted as before.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Extended RT Test

phasing, that deadline will always be met.

## The above theorem still stands although the deadline is Di instead

of Ti. For the response time find the least fixed-point of the
recurrence below:
a0 = Bi + Σ (Cj + 2S)
j ∈ H + {i}

an
an+1 = Bi + Ci + 2S + Σ (Cj + 2S)
j∈H
Tj

## 3/2000 Rate Monotonic Analysis, Nate Forman

What really happened on Mars?
(the first time)

## • Two tasks were critical for controlling communication on

the lander’s communication bus, the scheduler task
(bc_sched) and the distribution task (bc_dist).
• Each of these tasks checked each cycle to be sure that the
time = 0.125 s

bc_sched

bc_dist

bus active

## 3/2000 Rate Monotonic Analysis, Nate Forman

Mars Pathfinder: The Problem

## • ASI/MET was preempted by several medium priority

processes such as accelerometers and radar altimeters.

## • bc_sched started and discovered that bc_dist had not

completed. Under these circumstances, bc_sched reacted by
reinitializing the lander’s hardware and software and
terminating all ground command activities.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Mars Pathfinder: Resolution

## • “Faster, better, cheaper” had NASA and JPL using “shrink-

wrap” hardware (IBM RS6000) and software (Wind River
vxWorks RTOS).

## • Logging designed into vxWorks enabled NASA and Wind

River to reproduce the failure on Earth. This reproduction

inheritance.

## 3/2000 Rate Monotonic Analysis, Nate Forman

Resources
• www.sei.cmu.edu: Software Engineering Institute,
technical reports and presentations on rate monotonic
analysis