0% found this document useful (0 votes)
23 views25 pages

Module 4 Part 2

Low power vlsi

Uploaded by

www.vjnshylasree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views25 pages

Module 4 Part 2

Low power vlsi

Uploaded by

www.vjnshylasree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Periodic task scheduling

• In many real-time control applications, periodic activities represent


the major computational demand in the system.
• Periodic tasks typically arise from sensory data acquisition, low-level
servoing, control loops, action planning, and system monitoring.
• Such activities need to be cyclically executed at specific rates, which
can be derived from the application requirements.
• When a control application consists of several concurrent periodic
tasks with individual timing constraints, the operating system has to
guarantee that each periodic instance is regularly activated at its
proper rate and is completed within its deadline (which, in general,
could be different than its period).
Two periodic tasks with periods 4 and 6
Notation:
Assumptions:
Processor utilization factor
• Given a set Γ of n periodic tasks, the processor utilization factor U is the fraction
of processor time spent in the execution of the task set. Since Ci/Ti is the fraction
of processor time spent in executing task τi, the utilization factor for n tasks is
given by
𝐶𝑖
• 𝑈 = σ𝑛𝑖=1
𝑇𝑖
• The processor utilization factor provides a measure of the computational load on
the CPU due to the periodic task set.
• There exists a maximum value of U below which Γ is schedulable and above which
Γ is not schedulable.
• Such a limit depends on the task set (that is, on the particular relations among
tasks’ periods) and on the algorithm used to schedule the tasks.
• If the utilization factor of a task set is greater than 1.0, the task set cannot be
scheduled by any algorithm.
Rate Monotonic (RM) scheduling
• The Rate Monotonic (RM) scheduling algorithm is a simple rule that assigns
priorities to tasks according to their request rates.
• Specifically, tasks with higher request rates (that is, with shorter periods)
will have higher priorities.
• Since periods are constant, RM is a fixed-priority assignment: a
priority 𝑃𝑖 is assigned to the task before execution and does not change
over time.
• Moreover, RM is intrinsically preemptive: the currently executing task is
preempted by a newly arrived task with shorter period.
• RM is optimal among all fixed-priority assignments in the sense that no
other fixed-priority algorithms can schedule a task set that cannot be
scheduled by RM
RMA example-1
All tasks are released at time
𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖 0.
𝜏1 1 4 0.25
𝜏2 2 5 0.4 Since task τ1 has the smallest
𝜏3 5 20 0.25 period, it is the highest
priority task and is scheduled
first.

Note that at time 4 the second


instance of task τ1 is released
and it preempts the currently
running task τ3, which has the
lowest priority.
Theorem (RMA Bound)
• Any set of n periodic tasks is RM schedulable if the processor utilization, U,
is no greater than 𝑛(21/𝑛 − 1).
• When the number of tasks tend towards infinity, this expression will tend
towards lim 𝑛 21/𝑛 − 1 = ln 2 ≈ 0.69
𝑛→∞

• 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:

𝐶𝑖 𝑇𝑖 𝑈𝑖 = 𝐶𝑖 /𝑇𝑖 RM bound = 3(21/3 − 1) = 0.78.


The combined utilization of the three tasks is 0.75, which is less
𝜏1 3 20 0.15
than the RM bound. Hence the tasks are schedulable under RM
𝜏2 2 5 0.4
𝜏3 2 10 0.2

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

U=0.9>RM bound. However,


schedulable under RM

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

You might also like