CS452 - Real-Time Programming - Spring 2008
Lecture 31 - Practical Control and Calibration
Questions & Comments
- Anything else that would be useful
Real-time Scheduling
Much real-time computing operates in an environment like the following
- Groups of sensors that provide polling with fixed periodicity
- Sensor input triggers tasks which also run with fixed periodicity
Typical example, a group of sensors that returns
- the rotational speed of the wheels, and
- the exhaust mixture, and
- the torque, and ...
and a set of tasks that
- updates the engine parameters, and
- updates the transmission parameters, and
- passes the speed on to the instrument controller, and ...
Each time a sensor returns a new datum a scheduler runs
- makes ready any task that the data makes ready to run
- decides which of the ready tasks to schedule, and
- starts it running.
This is a hard real-time appoication.
Academic research on real-time programming divided the universe of
programs into three categories.
- Hard real-time: the controlled system self-destructs
if a deadline is ever missed.
- Soft real-time: the controlled system is incorrect is
a deadline is missed.
- Not real-time: it doesn't matter when the results are
ready.
(By this classification pretty well all real applications are soft
real-time.)
The deadlines of the example discussed above are the next scheduling of
the task.
- That is, a task completes successfully if and only if it completes
before it is next scheduled.
Why are we discussing this particular case?
- Because one of the few hard results standing the test of time applies
to this case, and
- because it is believed that this result applies to many neighbouring,
practical, cases.
- It is believed often to apply to bottleneck cases, where everything
happens together by accident.
The theorem applies to the important question,
- `Which task should be scheduled next in order to maximize use of the
processor with no deadlines ever being missed?'
And the answer is,
- `Rate monotone scheduling.'
which is
- Always schedule that ready task that runs most often.
How it's proved.
Consider all possible collections of tasks,
- each task having a periodicity Ti, and an execution time Ci. (C is for
cost.)
Show that, if the set of tasks can be scheduled
successfully by any scheduling algorithm, then
- it will be scheduled successfully by rate-monotone scheduling.
Proof
Definitions
Overflow at t. A task cannot be scheduled at t because its
previous execution is not complete.
Feasible. A set of tasks that can be successfully scheduled.
Response time. The time between the the readying of a task and
its completion. If a set of tasks is feasible then for every execution of
every task RT < Ti.
Critical instant for a task. The scheduling time at which it has
the longest response time.
Results
- The critical instant for a task occurs when it is readied at the same
time as all other tasks.
- When there are exactly two tasks, then rate monotone works.
- Let the higher priority task be task 0. It meets its deadlines if
C0 < T0
- Lower priority task can be scheduled at exactly the same time as
the higher priority one.
- Then as long as RT = C0 + C1 < T1 the set is feasible. This is
true regardless of the relative values of T0 and T1.
- If it is true for T0 > T1, then it is clearly true for T0
Return to: