Event-Driven Scheduling: (Closely Following Jane Liu S Book)
Event-Driven Scheduling: (Closely Following Jane Liu S Book)
Event-Driven Systems, 1
Principles
Admission: Assign priorities to Jobs
At events, jobs are scheduled according to their priorities
Important properties:
decisions, which job to execute next at EVENTS
(not time instants)
such as releases and completions of jobs
a (timer) interrupt is an (implementation of a) special event
never leaves a resource idle intentionally (greedy)
on line,
scheduling
admission
on line or off line
scheduling must be simple
(otherwise difficult/not possible on line)
Event-Driven Systems, 2
Restrictions Given Up
some restrictive assumptions of time-driven systems are
given up:
fixed inter-release times
minimum inter-release times
fixed number of rt tasks in systems
real-time and non real-time, number can vary
a priori fairly well known parameters
tasks come and go, overloading, ...
Event-Driven Systems, 3
T2
0
2
4
6
8
10
T1 misses deadline in Job 1 and 2/3, unnecessarily ...
T1
0
10
10
T2
Event-Driven Systems, 4
Important Variants
Static vs dynamic allocation to processors
static:
jobs are assigned to processors once and stay there
dynamic:
jobs migrate
example: one run queue served by all processors
static vs. dynamic priorities
jobs do not change their priorities
static:
(unless new tasks arrive)
priorities are recomputed frequently
dynamic:
e.g., FIFO is dynamic priority scheduling
preemptive or non preemptive
some tasks
all tasks
Real-Time Systems, 2009
Event-Driven Systems, 5
Event-Driven Systems, 6
Example, executions
P1
J1
0
J2 J3
P2
P1
J1
0
J2 J3
P2
J7
J4
4
J7
J5
J6
8
J8
J4 J5
J6
4
8
J7
J8
12
J1,3
J2,1
J5,2
J7,4
12
Event-Driven Systems, 7
preemptive
J3,2
J6,4
J8,1
J4,2
non preemptive
J1
0
J2 J3
P2
J5
4
J4
J6
8
J7
12
J8
}
J1,3
J2,1
J5,2
J7,4
Event-Driven Systems, 8
non preemptive
J3,2
J6,4
J8,1
J4,2
Which is better?
No general answer known!
If jobs have same release time:
preemptive is better (or equal)in a multiprocessor system if
cost for preemption is ignored
more precise: makespan is better
(makespan = response time of job that completes last)
how much better?
Coffman and Garey:
2 processors:
makespan(non-preemptive) <= 4/3 *
makespan(preemptive)
Event-Driven Systems, 9
Event-Driven Systems, 10
Event-Driven Systems, 11
Event-Driven Systems, 12
EDF Optimality
Proof: (informal)
assume a feasible, non EDF schedule
systematically transform it to an EDF schedule (3 steps)
rk
di
dk
Non
EDF
Ji
Jk
1.
Jk
Ji
2.
Jk
3.
Jk
Jk
Jk
Jk
Ji
Ji
Event-Driven Systems, 13
10
10
T2
Event-Driven Systems, 14
J2,2 (5,8]
0
J3,2,(2,7]
Real-Time Systems, 2009
J1
Event-Driven Systems, 15
J3
4
J2
8
Event-Driven Systems, 16
two versions:
strict:
slacks are computed at all times
Each instruction (prohibitively slow)
Each timer tick
non-strict:
slacks computed only at events (release and completion)
scheduler checks slacks of all ready jobs and reorders queue
Event-Driven Systems, 17
T3: (5.1,1.5)
1.5 1.5
0
12
16
t=0
t=2
T1,J2 released
T1,J2:1.25
T2,J1: 2.75 T3,J1: 1.6
d.h. T2,J1 lower priority than T3,J1
20
24
28
T3,J1: 0.85
Event-Driven Systems, 18
EDF
J3 deadline missed
J1
0
4
J1
feasible
0
J3
J2
8
J3
4
12
J2
12
Event-Driven Systems, 19
J1
0
P2
J3
4
P1
J2
0
J1 J2
J3
P2
4
EDF
feasible
Event-Driven Systems, 20
Scheduling Anomaly
release / deadline / execution
J1:
0
/
10
/
5
J2:
0
/
10
/
[2,6] varies
J3:
4
/
15
/
8
J4:
0
/
20
/
10
increasing priorities:
i < k => Prio(Ji) higher than Prio(Jk)
2 processors, preemptable but not migratable
intuitive approach:
check for worst case(a) and best case(b) execution times
and be confident ...
Real-Time Systems, 2009
Event-Driven Systems, 21
{
{
P1
P2
P1
P2
P1
P2
J3
J1
0
J2
0
12
16
20
J4
4
12
16
20
12
20
J3
8
16
J4
12
16
20
12
20
J3
8
16
J4
12
16
20
J1
0
J2
J4
0
J1
0
J2
0
4
J4
4
Event-Driven Systems, 22
J1
2
J1
2
E1=4
J2
6
J3
6
deadline missed
J3
10
12
14
16
18
20
22
12
14
16
18
20
22
J2
8
10
Event-Driven Systems, 23
Predictable/Sustainable Execution
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 ist 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 be those of the minimum and maximal
schedules.
Event-Driven Systems, 24
Predictable Execution
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.
Event-Driven Systems, 25
Validation Algorithms
... determine whether all jobs meet their deadlines
correct or not
accurate or not
overly pessimistic
overly optimistic
Event-Driven Systems, 26
Event-Driven Systems, 27
Priority Assignment
fixed priority:
fixed for task (and jobs) relativ to other tasks
dynamic priority:
priority of tasks changes at release and completion
times in relation to other tasks
fixed per job
dynamic per job
Event-Driven Systems, 28
12
16
Event-Driven Systems, 29
20
1.25 1.25
40
80
2.5
120
2.5 X
40
80
2.5
120
2.5
2.5
160
2.5
200
240
DM
2.5
160
2.5
200
240
RM
Event-Driven Systems, 30
Event-Driven Systems, 31
Event-Driven Systems, 32
J1
0
P2
J3
4
P1
J2
0
J1 J2
J3
P2
4
EDF
feasible
Event-Driven Systems, 33
discuss !
Pathological cases, mostly dynamic performs better
very hard to analyze for worst case
Event-Driven Systems, 34
T1 misses
T1 und T2 miss
2.3
0
4
8
No easy way to determine which jobs miss deadline ...
Event-Driven Systems, 35
10
6
8
Missed deadline
10
T2
Event-Driven Systems, 36
EDF
RM
T2: (5,2.5)
1.5
0
12
12
RM
not
optimal
in general
T2 misses deadline
Real-Time Systems, 2009
Event-Driven Systems, 37
Event-Driven Systems, 38
ln(2)
P): SU = 1
Event-Driven Systems, 39
Event-Driven Systems, 40
Event-Driven Systems, 41
Event-Driven Systems, 42
Event-Driven Systems, 43
Event-Driven Systems, 44
Schedulilibility Loss
Rate Monotonic, large n ...
g = min( 1 +1) /
SURM = ln(2g)+1-g
relative schedulibility(rs): relation to ln(2)
example:
n = 100000, m = 256
rs= 0.9986
=> 256 priorities is it !
Real-Time Systems, 2009
Event-Driven Systems, 45
12
16
1.25
2.5
20
24
28
1.5
6.5
Event-Driven Systems, 46