Module 3 - Real Time Task Scheduling - Part1
Module 3 - Real Time Task Scheduling - Part1
Scheduling
Task Instance
• Each time an event occurs, it triggers the task
that handles this event to run
• Real-time tasks therefore normally recur a large
number of times at different instants of time
depending on the event occurrence times
• It is possible that real-time tasks recur at
random instants
• T1 (1), T2 (1), T1 (2),
…Continued
• However, most real-time tasks recur with certain
fixed periods
• Example:
– A temperature sensing task in a chemical plant might
recur indefinitely with a certain period because the
temperature is sampled periodically, whereas a task
handling a device interrupt might recur at random
instants
• Each time a task recurs, it is called an instance of
the task
Relative and Absolute Deadlines of Task
Response Time
• Time it takes to produce results (from Arrival
time of the task)
Task Precedence
• A task is said to precede another task, if the
first task must complete before the second
task can start
• T1(1) T2(1)
• Partial Ordering
• T1, T2 , T3 , t4 and T5
• T1 –> T2; T3T4; T2, T4 T5
• Antisymmetric and Transitive
Data Sharing
• A task will precede another if the first task
wants to share data with the later
Type of Real Time Tasks
• Periodic Tasks
• Sporadic Tasks Hard Real time Highly
critcal – moderately critical
• Aperiodic Tasks soft tasks tolerate lapse
in time -- >logging in distributed less critical
tasks
Periodic Tasks
• Regular intervals
• Clock Driven
– Table Driven
– Cyclic
• Event Driven
– Simple Priority
– Rate Monotonic Analysis
– Earliest Deadline First
• Hybrid
– Round Robin
Table Driven Scheduling
• These schedulers precompute which task
should run when – and these details will be
stored in a table
…Continued…
…Continued
Cyclic Schedulers
• Small embedded applications
…Continued…
• While fixing frame size, below constraints to
be considered
– Minimum context switching
Utilization time
Examples
EDF
• A task is schedulable under EDF only if the following condition
2. Sufficient Condition
Examples
What if sufficient condition is not met?
• Disadvantage
– Difficult to support sporadic tasks and aperiodic
tasks
– Not optimal when task periods and deadlines
differ
DMA ( Deadline Monotonic Algorithm)
W.r.t RMA
Pr(T1)>Pr(T2)>Pr(T3)
To check Deadline miss or not under RMA scheduling
T1: e1 <= d110ms<35 Satisfied
T2: e1+e2<=d2 10+15 =25 not less than 20
T2 will miss its deadline if scheduled under RMA
W.r.t DMA
Pr(T2)>Pr(T1)>Pr(T3)
To check Deadline miss or not under DMA scheduling
T2: e2 <= d215ms<20 Satisfied
T1: e1+e2<=d1 10+15 =25 less than 35 Satisfied
T3: e1+e2+e3<=d3 45 <200 Satisfied
Context Switching Overhead
• In RMA utmost one task preempted (the
task that is currently running
• Worst Case Each task incurs atmost 2
context switches
– One when it prempts for high priority task (if any)
– Another when it completes and already prempted
task is to be assigned for execution
– where c is the constant time taken for
context switching
Some more Examples
Pr(T1)>Pr(T2)>Pr(T3)