05 EventDriven
05 EventDriven
Event-Driven Scheduling
Outline
Important Properties
• scheduling decisions are triggered by events
(not time instants)
• events are release, completion, blocking,
unblocking of jobs
• event triggers: scheduler calls, interrupts,
timers, …
• scheduling decisions are made online
• scheduling must therefore be simple
• admission is online or offline
• work-conserving schedulers never leave a resource idle
intentionally
T1
0 2 4 6 8 10
T2
0 2 4 6 8 10
Proof (informal)
• assume a feasible, non EDF schedule
• systematically transform it to an EDF schedule (3
steps) J Ji k
Non Ji Jk
EDF
Jk Ji Jk
1.
2. Jk Jk Ji
3. Jk Jk Ji
scheduler checks slacks of all ready jobs and runs the job with the
least slack
Two Versions:
• Strict: slacks are computed at all times
• each instruction (prohibitively slow)
• each timer tick
• Non-strict: slacks are computed only at events
(release, completion)
0 1 2 3 5 6
4
t = 0: J1 released and scheduled
t = 1: J2 released;
L(J1) = 3.5 – 1 – 1 = 1.5; L(J2) = 5 – 3 – 1 = 1 → J2 scheduled
t = 3.5: J1 deadline miss
0 1 2 3 4 5 6
Rationale
• no need to complete real-time jobs before deadline
• use time for other activities
Idea
• backwards scheduling
(Deadline <-> Release, turn around
precedence graph, EDF)
J1, 3 [0,6] J2, 2 [5,8]
• run as late as possible
J3, 2 [2,7]
• use latest possible release times
• optimal (analog EDF and strict LST) J1 J3 J2
0 3 6 9 12
0 3 6 9 12
J1 J3 J2
feasible
0 3 6 9 12
J1 J3 J1 J2
P1 J3missed Deadline P1
0 3 6 0 3 6
J2 J3
P2 P2
0 3 6 0 3 6
EDF feasible
• easy for time driven schedulers
• EDF is not optimal for multiprocessor systems
T1 T2 T3 T1 T2 T3 T1 T3 T2 T1 T3 T2 T1 T2
0 2 4 6 8 10 12 14 16 18
RM
0 1 2 3 4 5 6
DM
0 1 2 3 4 5 6
Conclusion (no proof):
RM not optimal but DM if d ≤ p for all
tasks Real-Time Systems: Event-Driven Scheduling 17
Optimality of Fixed Priority Schedulers
Utilization
• a task (p,e) requires e/p of the capacity of a processor
• any scheduler can admit at most up to full capacity:
For a task set T1 … Tn: ∑ ei/pi ≤ m is a necessary but not
sufficient condition for m processors
Schedulable Utilization / Utilization Bound
• can we establish a maximum utilization bound X such
that:
T1 … Tn: ∑ ei/pi
≤ X is sufficient?
• depends on the
scheduling
algorithm
Real-Time Systems: Event-Driven Scheduling 19
• the higher the
Utilization: RMS /
EDF
T1: (2 , 1) T2: (5 , 2.5) U=1
EDF T2 T1 T1 T2 T1
T1 T2 T1
0 3 6 9 12
RMS T1 T2 T1 T2 T1 T2 T1 T1
0 3 6 9 12
T2 misses deadline
fixed per job, dynamic at task level: the closer the absolute deadline
of a job at release time, the higher the priority
T1 T1 T1 T1 T1
0 1 2 3 4 5 6 7 8 9 10
T2 T2 T2 T2
0 1 2 3 4 5 6 7 8 9 10
T2 T1 T1 T2
T1 T2 T1
0 3 6 9 12
T2 2.3 T2
6
Real-Time Systems: Event-Driven Scheduling 27
EDF and Overload, Another Example
missed deadline
T1 T1 T1 T1
T1
0 1 2 3 4 5 6 7 8 9 10
T2 T2
T2
0 1 2 3 4 5 6 7 8 9 10
missed deadline
Informal Definition
• Given a set of periodic tasks with known minimal and maximal
execution times and a scheduling algorithm.
• A schedule produced by the scheduler when the execution time
of each job has its maximum (minimum) value is called a
maximum (minimum) schedule.
• An execution is called predictable, if for each actual schedule the
start and completion times for each job are bound by these
times in the minimum and maximal schedules.
• The execution of every job in a set of independent, preemptable
jobs with fixed release times is predictable when scheduled in
a priority driven manner on one processor.