EE5903 RTS Real Time Scheduling Policies: Bharadwaj Veeravalli
EE5903 RTS Real Time Scheduling Policies: Bharadwaj Veeravalli
Chapter 4
Real Time Scheduling Policies
Bharadwaj Veeravalli
[email protected]
Acknowledgements: Parts of this material from Hard Real-Time Computing Systems, G.C, Buttazzo, Springer, 3rd Edition;
RTS, J W Liu;
Outline of this Chapter
n RT Scheduling Algorithms
-- EDD, EDF, LLF
n Non-Preemptive Scheduling
n Time-Triggered Systems
n Scheduling Anomalies – Priority, # of CPUs, task sizes, resource
constraints, etc
n Handling Overloaded Conditions
n Imprecise task scheduling strategies (uniprocessor)
n Handling Periodic Tasks with EDF, RMA and DMA
n Quick note on Event Driven Schedulers
n Precedence Constraints – Static Scheduling algorithm
n Soft-real time issues (if time permits…)
Di
di
Reference
For periodic tasks, this may coincide
with period
α / β / γ: 1 / prec / Lmax
Denotes the problem of scheduling a set of tasks with
precedence constraints on a uniprocessor machine in order
to minimize the maximum lateness.
α / β / γ: 3 / no-preem / Σfi
α / β / γ: 2 / sync / ΣLatei
--
8
In this case Di is also the absolute deadline. (c) Bharadwaj V 2016
EDD (Cont’d)…
Lateness: Li=fi-di
Li>0
ri di fi
Li<0
This implies,
Which implies,
σ σ’ σ’’ … σ*
σ*= σEDD
Lmax (σ EDD ) is the minimum value
achievable by any algorithm
D
4
C
2
B
3
A
1
(c) Bharadwaj V 2016 17
EDF Guarantee test (online)
i t
Note: ck(t) – Remaining execution time
For all i ∑ ck (t ) ≤ d i − t from time t
k =1
c1(t)
c2(t)
c3(t)
c4(t)
22
(c) Bharadwaj V 2016
EDF Properties
n EDF is optimal for a uniprocessor schedule
under pre-emption;
- If there exists a feasible schedule then EDF
will schedule the tasks
Tasks
2
0 1 2 3 4 5 6 7 8 9
EDF under
Cannot be preempted
non-preemptive
mode
1
Deadline missed!
2
0 1 2 3 4 5 6 7 8 9
(c) Bharadwaj V 2016 31
Clairvoyant strategy
2
0 1 2 3 4 5 6 7 8 9
Time
Complexity ?
(c) Bharadwaj V 2016 36
RT Scheduling Anomalies
Some questions…
Precedence constraint
task;
P1 T1 T9
P2 T2 T4 T5 T7 Tr=12
P3 T3 T6 T8
t
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(c) Bharadwaj V 2016 40
Case: Anomalies under increased
processors
P1 T1 T8
P2 T2 T5 T9
P3
P4
T3
T4
T6
T7
L
t
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
P1 T1 T5 T8
P2 T2
P3 T3
T4 T6
T7
T9 L
t
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
T1:3 T9:9
T8:4 Removing the precedence
T2:2
relations between job J4 and
T7:4 jobs J7 and J8
T3:2
T6:4
L
T4:2
T5:4
P1 T1 T6 T9
P2 T2 T4 T7
P3 T3 T5 T8
t
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
n Workload definition:
Non-RT applications: As per queuing theory the
definition of workload (or also referred to as traffic intensity)
is: ρ = λ.Ĉ, where λ is the mean arrival rate of
tasks, and Ĉ: mean service time of a task;
max
Example
(Cont’d):
M1
M2 < M 1
M2
A periodic task set is schedulable under EDF if and only if it satisfies the
following criteria:
n n
∑e k / pk = ∑ uk ≤1
k=1 k=1
In this expression, we assumed that the period of the task is same as its
deadline. In reality this need not be true. In this case, the schedulability
criteria need to be changed as:
Thus, if pi > di then each task needs ei amount of computing time every
Min(pi,di) duration of time. Therefore we can rewrite the denominator pi of
the above expression as min(pi,di).
This means the above criteria is conservative when pi < di and is not
a necessary condition, but only a sufficient condition for EDF
schedulable.
n Schedulability Criteria:
Utilization Bound 1: Sum of the utilization due to tasks
must be less than or equal to 1 (Necessary Condition)
e: Execution time
p: Period of the task
n: Number of tasks
ui: Utilization due to task i
(c) Bharadwaj V 2016 64
RMA (Cont’d)…
Q: How does the plot of the bound look like? What do we infer from
the trend?
May be schedulable
Phase (delay in the occurrence of the first instance of a task i) (c) Bharadwaj V 2016
68
RMA (Cont’d)…
We assume that the context switching time is constant and equals c secs.
Thus the increase in execution time of ei of each task Ti is at most
(ei+2c). The factor 2c is the worst case number of content switches per
task (per preemption) - first switch when a task preempts a currently
running task and another c when this task completes.
A BG task can run when none of the FG tasks are ready to run.
BG tasks are treated as low priority tasks.