Title: Real-Time Operating Systems (Introduction)
1Real-Time Operating Systems(Introduction)
- M. KargahiSchool of ECE University of Tehran
2Real-Time Systems
- A Real-Time System is a system whose
specification include - Logically correctness of computations
- Temporally correctness (timeliness) of
computations - i.e., High predictability
- Sometimes called Reactive Systems
- Deadline
- Relative deadline ( hour / min / sec / msec /
?sec ) - Some applications
- Air Traffic Control (ATC)
- Interacts with radar, M.M. sub-system, operator,
- Real-time databases
- Multimedia and streaming applications
- Electronic games
- Mobile applications
3Real-Time Embedded Systems
- Requirements
- Environmental size, power (heat), weight, and
radiation-hardened - Performance responsiveness, predictability
- Economic cost, time-to-market
- Consequence safety, fault-tolerance, security
- Solutions
- Design process (specification, development,
testing, etc.) - Hardware (processor, memory, I/O, bus, etc.)
- Software (OS, libraries, applications, GUI, etc.)
- Tool chain (analysis, compiling, debugging,
integration, etc.)
4SW Development for RT EM Systems
- Requirements
- Multitasking for concurrent events (real-world
events occur in parallel) - Portability
- Software abstraction and modular design
- Verifiability, reusability, maintainability
- Controlling timing with a good granularity
- Sharing resources and dominating resource
constraints - Scheduling tasks, messages, and I/O
- Therefore, we need real-time (embedded) operating
systems - Moreover, we need development, monitoring, and
test environments
5Disciplines that Impact on Real-Time Systems
Engineering
6Basic concepts and terminologies
- Job/Service/Message/Packet Each unit of work
that is scheduled and executed by the system. (to
be allocated processor time and other resources) - Task A set of related jobs that jointly provide
some system function. - Release time The instant of time at which the
job becomes available for execution. - Deadline The instant of time by which the job
execution is required to be completed. - Response time The length of time from the event
sense time of the job to the instant when
actuation is done (output completes).
7Real-time systems classification
- Conventional classification
- Hard Real-Time (HRT)
- Soft Real-Time (SRT)
- Firm Real-Time (FRT)
- Criteria for the classification
- Functional criticality of jobs
- Usefulness of late results (Usefulness/Utility
function) - Tardiness Max (0 ,Completion-time Deadline)
- Deterministic or probabilistic nature of
constraints
8Real-time systems classification
- HRT systems
- Critical systems (ATC, Anti-Lock Braking)
- Late results have negative values and usually
result in catastrophic consequences ( if
tardinessgt0 ?F(tardiness)lt0 ) - Validation for meeting the timing constraints is
required - Almost always only deterministic nature is valid
for HRT systems (Weakly HRT Systems) - Systems where m out of k deadlines have to be met
- Feedback control systems, in which the control
becomes unstable with too many missed control
cycles - Suitable for dealing with other failures, e.g.,
Electro Magnetic Interference EMI - There may be no advantage in early completing a
job with a hard deadline - It is often advantageous, sometimes even
essential, to keep jitters in the response time
of a stream of jobs small
9Real-time systems classification
- SRT systems
- Non-critical systems (Multimedia, Virtual
Reality, Electronic Games, Online Transaction
Systems, Telephone Switches) - Usefulness functions specify the value of the
late results (F(x)?1) - F(tardiness)?0 for SRT systems is a decreasing
function - A system is SOFTER than the other if F(tardiness)
decreases at a slower rate for which - The timing requirements are often specified in
probabilistic terms - Usually, having a small average response time and
high throughput is more important than meeting
all deadlines
10Real-time systems classification
- FRT systems
- Non-critical systems (Forecasting systems,
Teleconferencing, Reporting a News, Doing a
Homework) - Late results have zero value (i.e., if
tardinessgt0 ? F(tardiness)0 ) - The timing requirements are often specified in
probabilistic terms
11Hard Real-Time Service Utility
12Soft Real-Time Service Utility
13Best Effort Service Utility
14Isochronal Hard Real-Time Utility
15Isochronal Soft Real-Time Utility
16Anytime Utility Curve
17A Reference Model
- Workload model Describes the application
- Resource model Describes the system resources
available to the applications - Resource-to-workload allocation algorithms
Mainly is applied using the OS - Processors Resources
- Processors Servers Active resources,
Transmission links. - Resources (Passive) Memory, Sequence numbers,
Mutexes, Database locks - Example Sliding window
- Job Message transfer
- Processor Data link
- Resource Sequence numbers (multiple instance
reusable resources)
18Workload Model
- Ji job number i
- ri release time
- ei execution time
- di absolute deadline
- Di relative deadline
- ri-, ri jittered release time
- ei-, ei jittered execution time
19Task Execution Time
- Estimation of the execution time depends on
- Source code and the complexity of the job
- Compiler non-unique mapping of source to object
code - Machine architecture
- No. of registers
- The size and organization of the cache
- Clock rate
- Memory refresh time affects on the effective
access time - pipeline,
- OS task scheduling but not on how the job is
scheduled, memory management, interrupt handling
overhead,
20Workload Model
- Analysis of straight line source code
- L1 a bc
- L2 b de
- L3 d a-f
- L1 can be translated to
- L1.1 Get the address of c
- L1.2 Load c
- L1.3 Get the address of b
- L1.4 Load b
- L1.5 Multiply
- L1.6 Store into a
- When does the execution time of L1 become
?i1..6Texec(L1.i)? - Even with no pipeline no interrupts, multiply
time depends on data
21Workload Model
- L4 while (p) do
- L5 Q1
- L6 Q2
- L7 Q3
- L8 end_while
- L9 if B1 then S1
- else if B2 then S2
- else if B3 then S3
- else S4
- end_if
- If B1 is true then T(B1)T(S1)T(JMP).
- If (not B1).B2 then T(B1)T(B2)T(S2)T(JMP).
- for may be better than while in writing
programs! - Using OO languages may not be a good idea!
- What if interrupts?
22Scheduling (Resource Allocation Model)
- A feasible schedule
- A valid schedule by which every job completes by
its deadline - A HRT scheduling algorithm is optimal
- If using the algorithm, the scheduler always
produces a feasible schedule if the given set of
jobs has any feasible schedules - Interaction among schedulers
- A system typically has a hierarchy of schedulers
- Logical resources should be scheduled on physical
resources, e.g., scheduling a DB and its locks - Some servers may be scheduled using the OS, while
the server schedules its client using a different
scheduler - Periodic tasks and the poller may be scheduled by
the OS, while the poller itself schedules the
aperiodic jobs
23More considerations
- Fault
- Transient
- Intermittent
- Permanent 1/30th of the transient faults
- Redundancy
- Spatial
- Time
- Power
- Transistor-level
- Gate-level
- Architecture-level
- OS-level
- Application-level
24Performance Measures
- Some traditional performance measures
- Maximum and average tardiness
- Maximum and average lateness
- Latenesscompletion-time deadline
- Unlike tardiness, lateness can be negative
- Maximum and average response time
- Miss rate
- Loss rate
- Invalid ratemiss rate loss rate