Scheduling Algorithms in Real-Time Operating Systems
Scheduling Algorithms in Real-Time Operating Systems
Characteristics:
Must produce correct result within a specified time
Late (and possibly early) actions are useless or harmful
Not simply a function of increasing system throughput
Requires timeliness and predictability
Do not have to be “fast systems”
A hard real-time system is a real-time system that must
meet its deadlines with a near-zero degree of flexibility.
deadline must be met or catastrophes occur.
i 1 periodi
where N is the number of real time tasks
lim(21/ N 1) ~ 0.69
n
Rate-Monotonic Scheduling
If we plot the priority of tasks as a function of
their rate, the result is a monotonically
increasing function; hence the name – Rate
Monotonic scheduling.
E.g.,
Period Priority
10 1 (highest)
12 2
15 3
20 4 (lowest)
Real-time scheduling depends on
1. Whether a system performs schedulability
analysis.
Static approaches
Static table-driven
Static priority-driven preemptive
Dynamic approaches
Dynamic planning-based
Dynamic best effort
Static table-driven scheduling
Applicable to periodic tasks.
Input -- Arrival time, Execution time, Deadline
and Priority of each task.
Output -- Schedule that meets requirements
of all periodic tasks.
Drawback – Inflexible.
Reason - Any change to any task
requirements requires that the schedule be
redone.
Static priority-driven
preemptive scheduling
Earliest Deadline First (EDF)
Based on dynamic priorities
Processes with soonest deadline given highest
priority
It may happen that a set of tasks is schedulable by
EDF, but not by RMS
EDF is complicated enough to have
unacceptable overhead
More complicated than RMS: harder to
analyze
Less predictable: can’t guarantee which
process runs when
Priorities must only be recalculated when a
new task arrives, as time advances equally for
all tasks
the algorithm behaves unpredictably at
overloads, and suffers more from overloads
than RM
A dynamic priority schedule exists if and only if utilization
is no greater than 100%
It places processes in a priority queue.
Whenever a scheduling event occurs
(task finishes, new task released, etc.)
the queue will be searched for the
process closest to its deadline.
EDF is not commonly found in industrial
real-time computer systems.
LST algorithm
The slack time of a task is the amount
of time until the task must be scheduled
or miss it’s deadline.
The least slack time algorithm is a
priority driven algorithm in which the
tasks receive priorities according the
their slack times. The shorter the slack
time the higher the priority.
slack = relative deadline – execution
left
Linux for Real Time Applications
Scheduling
Priority Driven Approach
Optimize average case response time
Interactive Processes Given Highest Priority
Aim to reduce response times of processes
Real Time Processes
Processes with high priority
No notion of deadlines
Problems with Linux