Module 4 Part 2
Module 4 Part 2
• Notice that this statement includes only a sufficient condition, but not necessary.
That is, you may find a set of tasks with a total utilization greater than RM bound,
but they are schedulable by the RM algorithm
• For example, the task set shown in example 1 has a total utilization of 0.9, which
is greater than the RM utilization bound, but it is still schedulable using the RM
policy
Verify the schedulability under RM and construct the schedule of the
following task set:
J2 J2 J3 J3 J1 J2 J2 J1 J1 J2 J2 J3 J3 J2 J2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Verify the schedulability under RM and construct the schedule of the
following task set:
𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖
𝜏1 3 7 3/7
𝜏2 5 16 5/16 Note that at time 7 the second
𝜏3 3 15 3/15 instance of task τ1 is released
and it preempts the currently
running task τ2, which has the
U=0.94>0.78. Schedulability not guaranteed lowest priority. However first
instance of τ2 finishes within its
J1 J1 J1 J3 J3 J3 J2 J1 J1 J1 J2 J2 J2 J2 J1 J1 J1 deadline
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Verify the schedulability under RM and construct the schedule of the
following task set:
𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖
𝜏1 1 4
𝜏2 2 5
𝜏3 5 20
J1 J2 J2 J3 J1 J2 J2 J3 J1 J3 J2 J2 J1 J3 J3 J2 J1 J2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
3 1 1
• 𝑈= + + = 0.825 > 3(21/3 − 1) = 0.78. Thus, schedulability is not
5 8 10
guaranteed
J1 J1 J1 J2 J3 J1 J1 J1 J2 J1 J1 J1 J3 J1 J1 J1 J2 J1 J1 J1 J3 J2 J1 J1 J1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
EDF
• The Earliest Deadline First (EDF) algorithm is a dynamic scheduling rule that
selects tasks according to their absolute deadlines. Specifically, tasks with earlier
deadlines will be executed at higher priorities.
• Since the absolute deadline of a periodic task depends on the current jth instance
as 𝑑𝑖,𝑗 = 𝜙𝑖 + 𝑗 − 1 𝑇𝑖 + 𝐷𝑖 , EDF is a dynamic priority assignment; that is,
different priorities could be assigned to individual instances in each task
• Moreover, it is typically executed in preemptive mode, thus the currently
executing task is preempted whenever another periodic instance with earlier
deadline becomes active.
• Note that EDF does not make any specific assumption on the periodicity of the
tasks; hence, it can be used for scheduling periodic as well as aperiodic tasks
• A set of periodic tasks is schedulable with EDF if and only if 𝑈 ≤ 1
𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖
EDF example 𝜏1 2 5 2/5
𝜏2 4 7 4/7
RM Vs EDF (same task set as before)
2 4
• 𝑈 = + ≈ 0.97
5 7
• Being U > 0.83, the schedulability of
the task set cannot be guaranteed
under RM, whereas it is guaranteed
under EDF.
• Indeed, as shown in Figure 4.13a, RM
generates a deadline miss at time t =
7, whereas EDF completes all tasks
within their deadlines (see Figure
4.13b).
• Another important difference
between RM and EDF concerns the
number of preemptions occurring in
the schedule. As shown in Figure
4.13, under RM every instance of task
τ2 is preempted, for a total number of
five preemptions in the interval T =
T1T2=35.
• Under EDF, the same task is
preempted only once in the same
interval. The smaller number of
preemptions in EDF is a direct
consequence of the dynamic priority
assignment, which at any instant
privileges the task with the earliest
deadline, independently of tasks’
periods.
RM vs EDF summary
• The schedulability of the task set is guaranteed under RM only if U ≤
𝑛(21/𝑛 − 1), whereas it is guaranteed under EDF if 𝑈 ≤ 1.
• RM tends to need more preemption; EDF only preempts when an earlier-
deadline task arrives.
• However, the timing behavior of a system scheduled according to a fixed-
priority algorithm (such as RM) is more predictable than that of a system
scheduled according to a dynamic-priority algorithm (such as EDF).
• In case of overloads, RM is stable in the presence of missed deadlines; the
same lower-priority tasks miss deadlines every time.
• There is no effect on higher-priority tasks. In contrast, when tasks are
scheduled using EDF, it is difficult to predict which tasks will miss their
deadlines during overloads.
Note: Deadline ≠ Period
RM vs EDF
• Construct the schedule and draw execution trace timeline for RM and
EDF for the following task set
𝑟𝑖 𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖
𝜏1 0 2 5
𝜏2 0 4 6
Deadline Monotonic
• RM algorithm assumes that for each task instance, the relative deadline is
equal to the period.
• The Deadline Monotonic (DM) priority assignment weakens the “period
equals deadline” constraint within a static priority scheduling scheme. This
algorithm was proposed as an extension of Rate Monotonic, where tasks
can have relative deadlines less than or equal to their period
DM
• According to the DM algorithm, each task is assigned a fixed priority 𝑃𝑖
inversely proportional to its relative deadline 𝐷𝑖 .
• Thus, at any instant, the task with the shortest relative deadline is
executed. Since relative deadlines are constant, DM is a static priority
assignment.
• As RM, DM is normally used in a fully preemptive mode; that is, the
currently executing task is preempted by a newly arrived task with shorter
relative deadline.
• When the relative deadline of every task is equal to its period, the RM and
DM algorithms are identical
• The Deadline-Monotonic priority assignment is optimal, meaning that, if a
task set is schedulable by some fixed priority assignment, then it is also
schedulable by DM.
DM example