↑ Real Time Systems: Notes

Predictability

 

One of the things we want to be able to do for a real-time system is validate that the system satisfies the timing constraints. This is difficult if the response times of jobs can vary wildly and erratically as job parameters (such as execution time) vary continuously.

Nonpreemptive EDF Anomaly

The above example shows that shortening the execution time of one job (shown in yellow) can cause another job (shown in blue) to miss its deadline.

2-CPU Priority Scheduling Anomalies

The above example shows how varying the execution time of one job can affect completion times on a two-CPU system in which jobs are assigned dynamically to a processor, but cannot migrate to another processor once started. The jobs are prioritized in the order J1, J2, J3, J4.

Who would have guessed that?

Predictability

Formal Definition of Predictability

The following definitions assume we are given a specific scheduling algorithm and set of jobs to schedule.

The maximal schedule is the one produced if all jobs take their maximimum possible execution times.

The minimal schedule is the one produced if all jobs take their minimum possible execution times.

Start Time Predictability

Ji is start-time predictable iff, for every possible actual start time s(Ji) of Ji,

s-(Ji) s(Ji) s+(Ji)

where s+(Ji) is the start time of Ji according to the maximal schedule and

s-(Ji) is the start time of Ji according to the minimal schedule.

Completion/Finish Time Predictability

Ji is completion-time predictable iff, for every possible actual completion time f(Ji) of Ji,

f-(Ji) f(Ji) f+(Ji)
where

f+(Ji) is the completion time of Ji according to the maximal schedule and f-(Ji) is the completion time of Ji according to the minimal schedule.

Generalizations of Predictability Definition

A job is predictable iff it is start-time and completion-time predictable.

A set of jobs is predictable iff all the jobs in the set are predictable.

Predictability Restrictions

Theorem: The execution of every job in a set of independent preemptible jobs with fixed release times is predictable when scheduled in a priority-driven manner on one processor.

Proof: The proof is by induction on the priority of the job,
relative to the other jobs in the set.

Clearly, the highest priority job J1 is predictable.

Assume all the i-1 highest priority jobs J1 ¼Ji-1 are predictable, and suppose that Ji is not predictable. There are only four ways this can happen:

  1. s(Ji) > s+(Ji)
  2. s(Ji) < s-(Ji)
  3. f(Ji) > f+(Ji)
  4. f(Ji) < f-(Ji)

Each of these cases leads to a contradiction. For example, consider case (1).

No job is scheduled before its release time, so s+(Ji) > ri.

For every higher priority job Jk with rks+(Ji), f+(Jk) s+(Ji), or else Ji could not start.

By the induction hypothesis, f(Jk) f+(Jk), so by transitivity of , f(Jk) s+(Ji).

It follows that in the actual schedule either the processor is idle at time s+(Ji) or some lower priority job is executing. Neither of these could be true with priority scheduling, so we have a contradiction.

The other cases are similar.

Linux Scheduling

Take a look at the code of the versions of the Linux scheduler (sched.c) and the RT Linux scheduler rtl_sched.c accessible via the links in this sentence. What scheduling algorithm does each use? Do they match any of the algorithms discussed here? Are they predictable?

T. P. Baker ($Id$)