0% found this document useful (0 votes)
21 views

Real-Time Task Scheduling2

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

Real-Time Task Scheduling2

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

Real Time Task Scheduling

ͽ Basic concepts related to task


ͽ Task instance
ͽ Relative vs absolute deadline
ͽ Response time
ͽ Task precedence
ͽ Data sharing
ͽ Types of Real time tasks
ͽ Periodic task
ͽ Sporadic task
ͽ Aperiodic task
Real Time Task Scheduling
ͽ Basic concepts related to scheduling
ͽ 1. Valid schedule
ͽ 2. Feasible schedule
ͽ 3. Scheduling points
ͽ 4. Preemptive scheduler
ͽ 5. Optimal scheduler
ͽ 6. Proficient scheduler
ͽ 7. Jitter
ͽ 8. Utilization
Task Scheduling
ͽ determining the order in which the various tasks are to be taken up for
execution by the operating system.
ͽ Every operating system relies on one or more task schedulers to prepare the
schedule of execution of various tasks it needs to run.
ͽ Each task scheduler is characterized by the scheduling algorithm it
employs.
Basic concepts:
ͽ 1. Valid Schedule. A valid schedule for a set of tasks is one where
ͽ at most one task is assigned to a processor at a time,
ͽ no task is scheduled before its arrival time, and
ͽ the precedence and resource constraints of all tasks are satisfied.

ͽ 2. Feasible Schedule. A valid schedule is called a feasible schedule, only if


all tasks meet their respective time constraints in the schedule.
Basic concepts:
ͽ 3. Scheduling Points:
ͽ The scheduling points of a scheduler are the points on time line at
which the scheduler makes decisions.
ͽ Scheduler does not need to run continuously, it is activated by the
operating system only at the scheduling points to make the scheduling
decision.
ͽ In a clock-driven scheduler, the scheduling points are defined at the
time instants marked by interrupts generated by a periodic timer. The
scheduling points in an event-driven scheduler are determined by
occurrence of certain events.
Basic concepts:
ͽ 4. Preemptive Scheduler
ͽ when a higher priority task arrives, suspends any lower priority task.
ͽ A preempted lower priority task can resume its execution only when no
higher priority task is ready.

ͽ 5. Optimal Scheduler
ͽ A real-time task scheduler is called optimal, if it can feasibly schedule
any task set that can be feasibly scheduled by any other scheduler.
ͽ If an optimal scheduler can not schedule some task set, then no other
scheduler should be able to produce a feasible schedule for that task
set.
Basic concepts:
ͽ 6. Proficient Scheduler
ͽ A task scheduler sch1 is said to be more proficient than another
scheduler sch2, if sch1 can feasibly schedule all task sets that sch2 can
feasibly schedule, but not vice versa. That is, sch1 can feasibly schedule
all task sets that sch2 can, but there exists at least one task set that sch2
can not feasibly schedule, whereas sch1 can.

ͽ If sch1 can feasibly schedule all task sets that sch2 can feasibly schedule
and vice versa, then sch1 and sch2 are called equally proficient
schedulers.
Basic concepts:
ͽ 7. Jitter:
ͽ Jitter is the deviation of a periodic task from its strict periodic behavior.

ͽ The arrival time jitter is the deviation of the task from arriving at the
precise periodic time of arrival. It may be caused by imprecise clocks, or
other factors such as network congestions.

ͽ Completion time jitter is the deviation of the completion of a task from


precise periodic points. The completion time jitter may be caused by the
specific scheduling algorithm employed which takes up a task for
scheduling as per convenience and the load at an instant, rather than
scheduling at some strict time instants.

ͽ Jitters are undesirable for some applications.


Basic concepts:
ͽ 8. Utilization:
ͽ The processor utilization of a task is the average time for which it executes per
unit time interval.
ͽ how much of the processor's capacity is used by that task over a specific
period.
ͽ In notations: for a periodic task Ti,

ͽ the utilization
ͽ where ei is the execution time
ͽ pi is the period of Ti. (Fixed time interval after which a task repeats)

ͽ For a set of periodic tasks {Ti}:

ͽ It is the objective of any good scheduling algorithm to feasibly schedule


even those task sets that have very high utilization.
Classification of real-time scheduling
algorithms based on scheduling points

Clock Driven Event driven Hybrid


• Table-driven • Simple priority-based • Round-robin
• Cyclic • Rate Monotonic Analysis
(RMA)
• Earliest Deadline First (EDF)
Scheduling points

Clock Driven Event Driven Hybrid


• Clock interrupt • Certain events • Both clock
interrupt and
event
occurrences
Event-driven schedulers
ͽ Event-driven schedulers are
ͽ more sophisticated than clock-driven schedulers and
ͽ more proficient and flexible than clock-driven schedulers.
ͽ more proficient because they can feasibly schedule some tasksets
which clock-driven schedulers cannot.
ͽ These are more flexible because they can feasibly schedule sporadic and
aperiodic tasks in addition to periodic tasks, whereas clock-driven
schedulers can satisfactorily handle only periodic tasks.
Classification
ͽ based on the type of task acceptance test that a scheduler carries out before
it takes up a task for scheduling.
ͽ The acceptance test is used to decide whether a newly arrived task would at
all be taken up for scheduling or be rejected.
ͽ Based on the task acceptance test used, there are two broad categories of task
schedulers:
ͽ 1. Planning-based
ͽ 2. Best effort
Classification
ͽ In planning-based schedulers, when a task arrives the scheduler first
determines whether the task can meet its dead-lines, if it is taken up for
execution. If not, it is rejected. If the task can meet its deadline and does not
cause other already scheduled tasks to miss their respective deadlines, then
the task is accepted for scheduling. Otherwise, it is rejected.
ͽ In best effort schedulers, no acceptance test is applied. All tasks that arrive
are taken up for scheduling and best effort is made to meet its deadlines. But,
no guarantee is given as to whether a task’s deadline would be met.
Classification
ͽ A third type of classification of real-time tasks is based on the target
platform on which the tasks are to be run.
ͽ Uniprocessor
ͽ Multiprocessor
ͽ Distributed
ͽ Uniprocessor scheduling algorithms are possibly the simplest of the three
classes of algorithms.
ͽ In multiprocessor and distributed scheduling algorithms first a decision has
to be made regarding which task needs to run on which processor and then
these tasks are scheduled.
Classification
ͽ In contrast to multiprocessors,
ͽ the processors in a distributed system do not possess shared memory.
ͽ no global uptodate state information available in distributed systems.
This makes uniprocessor scheduling algorithms unsuitable for use in
distributed systems.
ͽ Further in distributed systems, the communication among tasks is
through message passing. Communication through message passing is
costly. This means that a scheduling algorithm should not incur too much
communication over-head.
Classification of real-time scheduling
algorithms based on scheduling points

Clock Driven Event driven Hybrid


• Table-driven • Simple priority-based • Round-robin
• Cyclic • Rate Monotonic Analysis
(RMA)
• Earliest Deadline First (EDF)
Clock-Driven Scheduling
ͽ Scheduling points are determined by timer interrupts.
ͽ Scheduling decisions regarding which task to run next.
ͽ Also called off-line schedulers because these schedulers fix the schedule
before the system starts to run.
ͽ Adv: incur very little run time overhead
ͽ Disadv: can not satisfactorily handle aperiodic and sporadic tasks since the
exact time of occurrence of these tasks can not be predicted. (also called a
static scheduler)
ͽ Two important clock-driven schedulers:
ͽ 1. Table-driven and
ͽ 2. Cyclic schedulers.
1. Table-Driven Scheduling
ͽ precompute which task would run when
ͽ store the schedule in a table at the time the system is designed or configured.
ͽ The application programmer can be given the freedom to select his own
schedule for the set of tasks in the application and store the schedule in a
table.
1. Table-Driven Scheduling
ͽ major cycle / hyper period of the set of tasks ST
ͽ LCM(p1, p2, .., pn) is called the major cycle of the set of tasks ST.
ͽ Determines the size of the schedule table.

ͽ A major cycle of a set of tasks is an interval of time on the time line such
that in each major cycle, the different tasks recur identically.

ͽ For any given task set it is sufficient to store entries only for LCM(p1,
p2, .., pn) duration in the schedule table.
Table-Driven Scheduling

Task p e

1. T1
T2
20
100
5
20
T3 250 30

Task P e
2. T1 40 1
T2 10 2
T3 20 1
T4 20 5
Table-Driven Scheduling
Task P e
T1 4 1
T2 5 1.8
T3 20 1
T4 20 2

ͽ Utilization: 0.25, 0.36, 0.05, and 0.1

ͽ Example S

You might also like