Lecture 11 Realtime OS
-
Upload
priyanka-rauthan -
Category
Documents
-
view
214 -
download
0
Transcript of Lecture 11 Realtime OS
-
8/6/2019 Lecture 11 Realtime OS
1/35
Introduction toReal-time Operating Systems (RTOS) andScheduling Algorithms
Lecturer: Prof. Yifeng Zhu
Fall, 2010
-
8/6/2019 Lecture 11 Realtime OS
2/35
What is a Real-Time System?
Real-time systems have been defined as: "thosesystems 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 resultsare produced"; J. Stankovic, "Misconceptions About Real-Time Computing,"
IEEE Computer, 21(10), October 1988.
-
8/6/2019 Lecture 11 Realtime OS
3/35
Real-Time Characteristics
Real-time systems often are comprised of acontrolling system, controlled system and
environment.
Controlling system: acquires information about environmentusing sensors and controls the environment with actuators.
Timing constraintsderived from physicalimpact ofcontrolling systems activities. Hard and soft
constraints. Periodic Tasks: Time-driven recurring at regular intervals. Aperiodic: Event-driven.
-
8/6/2019 Lecture 11 Realtime OS
4/35
Typical Real-Time Systems
Controller(Controlling System) Controlled
System
Environment
Sensors
Actuators
-
8/6/2019 Lecture 11 Realtime OS
5/35
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 notfatal. 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
-
8/6/2019 Lecture 11 Realtime OS
6/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism2. Responsiveness3. User control4. Reliability5. Fail-soft operation
-
8/6/2019 Lecture 11 Realtime OS
7/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism No OS is fully deterministic due to resource competition
among multiple processes
Metrics: the maximum delay before acknowledging a highpriority device interrupt
In real-time OS, usually upper-bounded In non-real-time OS, usually unbounded In non-RT this delay may be in the order of 10s and 100s of
millisecs, whereas in an RT it may have an upper-bound offew microsec to 1 millisec.
-
8/6/2019 Lecture 11 Realtime OS
8/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism2. Responsiveness
Metrics: the time for servicing the interrupt once it has beenacknowledged.
Comprises: Time to transfer control, (and context switch) and execute the
ISR
Time to handle nested interrupts, the interrupts that should beserviced when executing this ISR. Higher priority Interrupts.
response time = f(responsiveness, determinism)
-
8/6/2019 Lecture 11 Realtime OS
9/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism2. Responsiveness3. User control
User has a much broader control in RT-OS than in regular OS Priority Hard or soft deadlines Deadlines Memory Management: paging or swapping Name the processes to be resident in memory Scheduling policies
-
8/6/2019 Lecture 11 Realtime OS
10/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism2. Responsiveness3. User control4. Reliability
Failure in RT-OS may be catastrophic: life and death, financialloss, equipment damage.
In the event of a failure, immediate detection and correction isimportant.
Notify user processes to rollback. Apply compensation.
-
8/6/2019 Lecture 11 Realtime OS
11/35
11
RTOS Characteristics
Reliability
Number of 9s Downtime per yr Typical applications3 Nines (99.9%) ~ 9 hrs Desktop
4 Nines (99.99%) ~ 1 hr Enterprise Servers
5 Nines (99.999%) ~ 5 min Carrier-Class Servers
6 Nines (99.9999%) ~ 31 sec Carrier Switch Equipment
Reliability / Availability ChartProviding Open Architecture High Availability Solutions (HA Forum)
-
8/6/2019 Lecture 11 Realtime OS
12/35
Characteristics of Real-Time Operating Systems
Unique requirements in five general areas:
1. Determinism2. Responsiveness3. User control4. Reliability5. Fail-soft operation
the ability of a system to fail in such a way as to preserve as muchcapability and data as possible
A real-time system is stable/fail-soft if, in cases where it isimpossible to meet all task deadlines, the system will meet thedeadlines of its most critical, highest-priority tasks, even if someless critical task deadlines are not always met.
-
8/6/2019 Lecture 11 Realtime OS
13/35
Characteristics of Real-Time Operating Systems
To meet these requirements, real-time OS typically include the followingfeatures:
Fast process or thread switch Small size (with corresponding minimal functionality) Ability to respond to external interrupts quickly Multitasking with interprocess communication tools such as semaphores,
signals, and events
Use of sequential files that can accumulate data at a fast rate Preemptive scheduling based on priority Minimization of intervals during which interrupts are disabled Primitives to delay tasks for a fixed amount of time and to pause/resume
tasks
Special alarms and time-outs
-
8/6/2019 Lecture 11 Realtime OS
14/35
-
8/6/2019 Lecture 11 Realtime OS
15/35
Preemptive vs Non-preemptive scheduling
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
-
8/6/2019 Lecture 11 Realtime OS
16/35
Some Definitions
Timing constraint: constraint imposed on timing behaviorof a job: hard or soft.
Release Time: Instant of time job becomes available forexecution. 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 tobe completed. If deadline is infinity, then job has nodeadline. Absolute deadline is equal to release time plus
relative deadline
Response time: Length of time from release time to instantjob completes.
-
8/6/2019 Lecture 11 Realtime OS
17/35
Real-Time Workload
Job (unit of work) a computation, a file read, a message transmission, etc
Attributes Resources required to make progress Timing parameters
Released
Absolute
deadline
Relative deadline
Execution time
-
8/6/2019 Lecture 11 Realtime OS
18/35
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
5 10 150
-
8/6/2019 Lecture 11 Realtime OS
19/35
Schedulability
Property indicating whether a real-time system (a set ofreal-time tasks) can meet their deadlines
(4,1)
(5,2)
(7,2)
-
8/6/2019 Lecture 11 Realtime OS
20/35
Real-Time Scheduling
Determines the order of real-time task executions Static-priority scheduling Dynamic-priority scheduling
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
-
8/6/2019 Lecture 11 Realtime OS
21/35
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
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
22/35
RM (Rate Monotonic)
Executes a job with the shortest period
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
23/35
RM (Rate Monotonic)
Executes a job with the shortest period
(4,1)
(5,2)
(7,2)
Deadline Miss !
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
24/35
Response Time
Response time Duration from released time to finish time
(4,1)
(5,2)
(10,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
25/35
-
8/6/2019 Lecture 11 Realtime OS
26/35
EDF (Earliest Deadline First)
Optimal dynamic priority scheduling A task with a shorter deadline has a higher
priority
Executes a job with the earliest deadline(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
27/35
-
8/6/2019 Lecture 11 Realtime OS
28/35
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
29/35
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
30/35
EDF (Earliest Deadline First)
Optimal scheduling algorithm if there is a schedule for a set of real-time tasks,
EDF can schedule it.
(4,1)
(5,2)
(7,2)
5
5
10
10 15
15
T1
T2
T3
-
8/6/2019 Lecture 11 Realtime OS
31/35
EDF & RM
Real Time Scheduling algorithms RMS EDF
-
8/6/2019 Lecture 11 Realtime OS
32/35
EDF & RM
Another example of real-time scheduling with RMS and EDF
-
8/6/2019 Lecture 11 Realtime OS
33/35
Real-time Scheduling
Dynamic planning-based scheduling After the task arrives before execution begins, a
schedule is prepared that includes the new as well
as the existing tasks. If the new one can go without affecting the existing
schedules than nothing is revised.
Else schedules are revised to accommodate thenew task.
Remember that sometimes new tasks may berejected if deadlines cannot be met.
-
8/6/2019 Lecture 11 Realtime OS
34/35
Real-Time Scheduling
Dynamic best-effort scheduling: used in most commercial RTs of today tasks are aperiodic, no static scheduling is possible some short-term scheduling such as shortest deadline first
is used.
Until the task completes we do not know whether it hasmet the deadline.
-
8/6/2019 Lecture 11 Realtime OS
35/35
Acknowledgement
These slides are modified from the lecture slides ofInsup Lee @ University of Pennsylvania
http://www.cis.upenn.edu/~lee/home/home.html