Lect 04
Lect 04
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Advanced Real-Time Systems
Lecture 4/6
Enrico Bini
November 2, 2012
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Outline
1 Earliest Deadline First: basics
2 EDF: demand bound function
3 EDF: sucient tests
4 EDF: sensitivity analysis
5 Example
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Earliest Deadline First
Task model is still the same
i
= (C
i
, T
i
, D
i
);
In FP, priorities are per task: all jobs of same task that
have the same priority;
In EDF, priorities are per job: jobs are prioritized
according to their absolute deadline.
Draw an example of schedule.
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Most interesting feature
Theorem (Liu and layland, 1973 [?])
If a task set is feasible, then it is EDF-schedulable.
Theorem (Liu and Layland, 1973 [?])
If D
i
= T
i
(implicit deadline) then a task set is
EDF-schedulable if and only if:
n
i=1
U
i
1
Any FP-schedulable task set is also EDF-schedulable task
set.
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Outline
1 Earliest Deadline First: basics
2 EDF: demand bound function
3 EDF: sucient tests
4 EDF: sensitivity analysis
5 Example
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Demand bound function
If D
i
= T
i
the schedulability condition becomes more
complicated.
Theorem (Lemma 3 in [?])
The task set N is EDF-schedulable if and only if:
t 0
n
i=1
max
_
0,
_
t + T
i
D
i
T
i
__
C
i
t
The LHS is called demand bound function dbf(t) of the task
set at t.
dbf(t) is the maximum amount of work of jobs with both
activation and deadline in [0, t].
no per-task condition: any task task may inuence others
max{0, } only needed for i with D
i
> T
i
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Making it more practical
Obviously, checking t > 0 is not very practical
By observing the step shape of the dbf we can check only
at the points where the steps occur
Theorem (Lemma 3 in [?])
The task set N is EDF-schedulable if and only if
i
U
i
1
and:
t D
n
i=1
max
_
0,
_
t + T
i
D
i
T
i
__
C
i
t
with
D = {d
i,k
: d
i,k
= kT
i
+ D
i
, i N, k N, d
i,k
D
}
and D
= lcm(T
1
, . . . , T
n
) + max
i
{D
i
}.
H = lcm(T
1
, . . . , T
n
) is often called hyperperiod of the task set.
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Reducing the number of points
If U < 1, then the for large t the condition is always true
then D
=
U
1 U
max
i
{T
i
D
i
}
what happen to D
if max
i
{T
i
D
i
} 0?
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Reducing the number of points
If U < 1, then the for large t the condition is always true
then D
=
U
1 U
max
i
{T
i
D
i
}
what happen to D
if max
i
{T
i
D
i
} 0?
the task set is obviously EDF-schedulable,
max
i
{T
i
D
i
} 0 i, D
i
T
i
EDF is sustainable, hence if D
i
= T
i
is sched then D
i
T
i
also sched
Since U < 1, the task set is sched
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Faster exact test
All deadlines in [0, D
} initial assignment
3: while dbf(t) t dbf(t) > d
min
do
4: if dbf(t) < t then
5: t dbf(t)
6: else
7: t max{d
i,k
: d
i,k
< t} escape from xed points
8: end if
9: end while
10: if dbf(t) d
min
then task set EDF-schedulable
11: else task set not EDF-schedulable
12: end if
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Outline
1 Earliest Deadline First: basics
2 EDF: demand bound function
3 EDF: sucient tests
4 EDF: sensitivity analysis
5 Example
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Sucient tests
By replacing T
i
with the more conservative value
min{T
i
, D
i
}, we nd
n
i=1
C
i
min{T
i
, D
i
}
1
the ratio
C
i
min{T
i
,D
i
}
is often called density of the task
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
More sophisticated su test
Devi proposed the following sucient test
Assuming that tasks are sorted by non-decreasing relative
deadline (D
i
D
2
. . . D
n
)
Theorem (Theorem 1 in [?])
The task set N is EDF-schedulable if:
k = 1, . . . , n D
k
k
i=1
U
i
+
k
i=1
T
i
min{T
i
, D
i
}
T
i
C
i
D
k
Proved to strictly dominate the density test
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
FTPAS for EDF
Albers et al. [?] proposed a Fully Polynomial Time
Approximation Scheme.
The i-th term in dbf(t) can be upper bounded by
max{0,
_
t D
i
+ T
i
T
i
_
}C
i
dub
i
(k, t)
=
_
max{0,
_
tD
i
+T
i
T
i
_
}C
i
t d
i,k
= (k 1)T
i
+ D
i
U
i
(t + T
i
D
i
) t > d
i,k
so that
k
k + 1
i
dub
i
(k, t) dbf(t)
i
dub
i
(k, t)
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
FTPAS for EDF
This enables a quite interesting result
Theorem
If U 1 and
t D(k) = {d
i,k
R
+
: d
i,k
= (k 1)T
i
+ D
i
, 1 k k}
n
i=1
dub
i
(k, t) t
then the task set is schedulable.
Otherwise it is not schedulable over a CPU with speed
k
k+1
.
In this way only nk evaluation of the dbf are needed.
We can trade accuracy vs. complexity. As k it
becomes necessary and sucient.
FPTAS
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Outline
1 Earliest Deadline First: basics
2 EDF: demand bound function
3 EDF: sucient tests
4 EDF: sensitivity analysis
5 Example
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Min EDF-schedulable speed
Similarly as in the FP case we can nd the minimum
EDF-schedulable speed as follows
r
min
= max
tD
n
i=1
max
_
0,
_
t+T
i
D
i
T
i
__
C
i
t
However D
= H + max
i
{D
i
}, because we are changing the
speed and then altering the linear upper bound that motivates
the expression
D
=
U
1 U
max
i
{T
i
D
i
}
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Max EDF-schedulable comp time
The maximum EDF-schedulable C
max
k
can be computed in a
similar way as in FP
C
max
k
= min
tD,tD
k
t
n
i=1
i=k
max
_
0,
_
t+T
i
D
i
T
i
__
C
i
_
t+T
k
D
k
T
k
_
Here too, D
= H + max
i
{D
i
}.
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Outline
1 Earliest Deadline First: basics
2 EDF: demand bound function
3 EDF: sucient tests
4 EDF: sensitivity analysis
5 Example
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Sucient tests
Let us have the following task set
T
i
D
i
C
i
3 5 1
8 8 2
20 10 5
Not DM-schedulable since R
3
= 14 > D
3
= 10
Density test
1
3
+
2
8
+
5
10
=
13
12
> 1
Devis test
k = 1 D
1
U
1
D
1
OK
k = 2 D
2
(U
1
+ U
2
) D
2
OK
k = 3 D
3
(U
1
+ U
2
+ U
3
) + (T
3
D
3
)U
3
D
3
U
1
+ U
2
+
C
3
D
3
1 NO
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Example
Exact test:
t D
n
i=1
max
_
0,
_
t + T
i
D
i
T
i
__
C
i
t
with
D = {d
i,k
: d
i,k
= kT
i
+ D
i
, i N, k N, d
i,k
D
}
Computing the upper bound D
=
U
1 U
max T
i
D
i
=
5
6
1
6
10 = 50
D = {5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50,
8, 16, 24, 32, 40, 48, 10, 30, 50}
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Example: QPA
d
min
= 5
t = 50, dbf(50) = 16 + 6 2 + 3 5 = 43
t = 43, dbf(43) = 13 + 5 2 + 2 5 = 33
t = 33, dbf(33) = 10 + 4 2 + 2 5 = 28
t = 28, dbf(28) = 8 + 3 2 + 5 = 19
t = 19, dbf(19) = 5 + 2 2 + 5 = 14
t = 14, dbf(14) = 4 + 2 + 5 = 11
t = 11, dbf(11) = 3 + 2 + 5 = 10
t = 10, dbf(10) = 2 + 2 + 5 = 9
t = 9, dbf(9) = 2 + 2 = 4
exit because dbf(9) = 4 < d
min
= 5
dbf computed 9 times, instead of |D| = 22 times
Advanced
Real-Time
Systems
Enrico Bini
Earliest
Deadline First:
basics
EDF: demand
bound
function
EDF:
sucient tests
EDF:
sensitivity
analysis
Example
Example: FPTAS
k = 1 D(1) = {5, 8, 10}
t = 5 1 + 0 + 0 5
t = 8 2 + 2 + 0 8
t = 10 2.666 + 2.5 + 5 > 10
k = 2 D(2) = {5, 8, 10, 16, 30}
t = 5 1 + 0 + 0 5
t = 8 2 + 2 + 0 8
t = 10 2.666 + 2 + 5 10
t = 16 4.666 + 4 + 5 16
t = 30 9.333 + 7.5 + 10 30
EDF-schedulable
non EDF-schedulable over a speed
1
2
processor