Introduction To Real-Time Operating Systems (RTOS) and Scheduling Algorithms
Introduction To Real-Time Operating Systems (RTOS) and Scheduling Algorithms
Fall, 2010
What is a Real-Time System?
Real-timesystems have been defined as: "those
systems in which the correctness of the system
depends not only on the logical result of the
computation, but also on the time at which the results
are produced";
J. Stankovic, "Misconceptions About Real-Time Computing,"
IEEE Computer, 21(10), October 1988.
Real-Time Characteristics
Real-time systems often are comprised of a
controlling system, controlled system and
environment.
Controlling system: acquires information about environment
using sensors and controls the environment with actuators.
Timing
constraints derived from physical impact of
controlling systems activities. Hard and soft
constraints.
Periodic Tasks: Time-driven recurring at regular intervals.
Aperiodic: Event-driven.
Typical Real-Time Systems
Environment
Actuators
Controller
(Controlling System) Controlled
System Sensors
Hard versus Soft
Hard: failure to meet constraint is a fatal fault.Validated
system always meets timing constraints.
Deterministic constraints
Probabilistic constraints
Constraints in terms of some usefulness function.
Soft: late completion is undesirable but generally not
fatal.
No validation or only demonstration job meets some statistical constraint.
Occasional missed deadlines or aborted execution is usually considered
tolerable.
Often specified in probabilistic terms
Characteristics of Real-Time Operating Systems
11
Characteristics of Real-Time Operating Systems
Time-Sharing Real-Time
Systems Systems
Capacity High throughput Schedulability
Responsiveness Fast average Ensured worst-
response case response
Overload Fairness Stability
Preemptive Scheduling
Task execution is preempted and resumed later
Preemption occurs to execute higher priority task.
Offers higher schedulability
Involves higher scheduling overhead due to context switching
Non-preemptive Scheduling
Once a task starts executing, it completes its full execution
Offers lower schedulability
Less overhead due to less context switching
Some Definitions
Timing constraint: constraint imposed on timing behavior
of a job: hard or soft.
Release Time: Instant of time job becomes available for
execution. If all jobs are released when the system begins
execution, then there is said to be no release time
Deadline: Instant of time a job's execution is required to
be completed. If deadline is infinity, then job has no
deadline. Absolute deadline is equal to release time plus
relative deadline
Response time: Length of time from release time to instant
job completes.
Real-Time Workload
Relative deadline
Real-Time Task
Task : a sequence of similar jobs
Periodic task (p,e)
Its jobs repeat regularly
Period p = inter-release time (0 < p)
Execution time e = maximum execution time (0 < e < p)
Utilization U = e/p
0 5 10 15
Schedulability
Property indicating whether a real-time system (a set of
real-time tasks) can meet their deadlines
(4,1)
(5,2)
(7,2)
Real-Time Scheduling
Determines the order of real-time task executions
Static-priority scheduling
Dynamic-priority scheduling
(4,1)
(5,2)
5 10 15
(7,2)
5 10 15
RM (Rate Monotonic)
Optimal static-priority scheduling
It assigns priority according to period
A task with a shorter period has a higher priority
Executes a job with the shortest period
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
RM (Rate Monotonic)
Executes a job with the shortest period
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
RM (Rate Monotonic)
Executes a job with the shortest period
Deadline Miss !
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
Response Time
Response time
Duration from released time to finish time
T1 (4,1)
T2 (5,2)
5 10 15
T3 (10,2)
5 10 15
Response Time
Response time
Duration from released time to finish time
Response Time
T1 (4,1)
T2 (5,2)
5 10 15
T3 (10,2)
5 10 15
EDF (Earliest Deadline First)
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
EDF (Earliest Deadline First)
Optimal scheduling algorithm
if there is a schedule for a set of real-time tasks,
EDF can schedule it.
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
EDF & RM