Real-time Operating Systems
VO Embedded Systems Engineering Armin Wasicek 11.12.2012
Real-time Operating Systems VO Embedded Systems Engineering Armin - - PowerPoint PPT Presentation
Real-time Operating Systems VO Embedded Systems Engineering Armin Wasicek 11.12.2012 Overview Introduction OS and RTOS RTOS taxonomy and architecture Application areas Mixed-criticality systems Examples: UAV, Synthetic
Real-time Operating Systems
VO Embedded Systems Engineering Armin Wasicek 11.12.2012
Overview
11.12.2012 Real-time Operating Systems 2
Computer system classification
Transformational systems compute output values from input values, then stop.
Interactive systems constantly interact with their
Reactive systems continuously react to stimuli from the
environment.
Real-Time Systems
deadline miss can have catastrophic results
result has utility after the deadline
In a real-time computer system the correctness of the system behavior depends not only on the logical results of the computations, but also on the physical instant at which these results are produced. In a real-time computer system the correctness of the system behavior depends not only on the logical results of the computations, but also on the physical instant at which these results are produced.
Utility reaction time reaction time
deadline
Utility
Determinism
Compare e.g. a process controller and a compiler
Excurs: Predictability
A system behaves deterministically if – given a set of initial conditions at time t0 – a sequence of inputs always produces the same sequence of outputs at any future instant t.
11.12.2012 Real-time Operating Systems 6
Operating Systems
Operating System (OS):
access low level functions
User Hardware
Input devices
Application
Output devices System calls Signals Registers Interrupts
Operating system
Embedded system is a hardware/software artifact.
Common OS Services
Real-Time Operating Systems (RTOS)
timing constraints
context switches, ...)
Scheduling
task in ready state can execute?
monotonic, cooperative
created dead ready running blocked
11.12.2012 Real-time Operating Systems 10
Schedulability Analysis
Need to know timing characteristics of runtime system (e.g., OS, uC) and of all tasks (WCET) for real-time scheduling In a hard real-time system, we need to a high confidence that no deadline will be missed during operation.
11.12.2012 Real-time Operating Systems 11
Mutual Exclusion – Priority Inversion
systems!
T1 T2 T3
11.12.2012 Real-time Operating Systems 12
priority
Is a scheduler absolutely necessary?
No, you can meet deadlines without any RTOS (generate offline schedule, implement it):
reserve max. time for interrupts)
multiple of all task periods) or unnecessary overhead (shorten task periods)
11.12.2012 Real-time Operating Systems 13
11.12.2012 Real-time Operating Systems 14
RTOS taxonomy (1)
Small, fast, proprietary kernels (μC-OS II, QNX, WinCE)
Real-Time extensions
(RT-Linux, Xenomai, RT-Posix, RT-MACH, RT-WinNT)
Existing OS is modified such that non-rtos binaries run without modification
Thin RT-kernel stay below the native OS
Changes are made in the core of OS
Kernel is extended to provide support for resource reservation
11.12.2012 Real-time Operating Systems 15
RTOS taxonomy (2)
Component based kernels
included to compose an RTOS
and application
composition
eCos PURE - embedded applications MMLite - dynamic reconfiguration of components
11.12.2012 Real-time Operating Systems 16
RTOS taxonomy (3)
Quality-of-Service (QoS) based kernels
Research kernels
aspects of RTOS
time-triggered, distributed SPRING admission control, reservation HARTOS distributed communication
11.12.2012 Real-time Operating Systems 17
Monolithic Kernels
kernel space
abstractions of the hardware
messaging involved are low
Hardware Kernel space User space
Applications Libraries File systems IO/Device management Process management Interprocess comm. Memory management
11.12.2012 Real-time Operating Systems 18
Microkernels
a minimum
IPC, Resource Allocation (not scheduling), I/O …
Improves maintainability, predictability, security
Isolates hard real-time tasks
Virtual Environment for other paravirtualized RTOSs
Used in e.g. Mobile Phones for the Android Platform
User space
Server Software
Hardware Kernel space
Process server Drivers Microkernel Applications Libraries File systems
IPC
11.12.2012 Real-time Operating Systems 19
Exokernels
Two basic principles:
Low-level interface to hardware provided by libOSes
memory management)
Hardware Kernel space User space
Applications Libraries Exokernel libOSes
http://pdos.csail.mit.edu/exo/
11.12.2012 Real-time Operating Systems 20
Partioning RTOS
RTOS can partition resources in time and space
Memory protection: one partition cannot corrupt the memory of the software in another partition
Shared resources: each partition enjoys a certain amount of time on the resource, regardless of what other software is doing. → Enables the ability to run mixed-criticality applications
Definition: Mixed criticality
exist on the same computational platform.
A mixed-critical system is an integrated suite of hardware, operating system and middleware services and application software that supports the execution of safety-critical, mission-critical, and non- critical software within a single, secure compute platform.
11.12.2012 Real-time Operating Systems 23
Safety Integrity Levels (SIL)
Design, Verfication, Certification, Dependability, Security
against software or system failure
and measures for safety related software development.
SIL Failures per hour MTTF (years) 4 10-5 to 10-4 105 to 104 3 10-4 to 10-3 104 to 103 2 10-3 to 10-2 103 to 102 1 10-2 to 10-1 102 to 10 Verification Technique SIL1 SIL2 SIL3 SIL4 Formal Proof R R HR Probabilistic testing R R HR Static analysis R HR HR HR Dynamic analysis and testing R HR HR HR Software complexity metrics R R R R 24 11.12.2012 Armin Wasicek
Benefits of Mixed-criticality systems
less physical components
multiple software providers "For size, weight, and power (SWaP) reasons, avionics manufacturers were including more and increasingly complex functions; instead of having a new box on the aircraft every time they added something like that, they wanted to integrate different types of applications
the same central processing unit (CPU).
11.12.2012 Real-time Operating Systems 25
Possible system architecture
levels of criticality on the same computing platform
execution compartments
shield compartments in time and space 11.12.2012
Real-time Operating Systems 26
COMPUTING PLATFORM (PARTITIONED) RTOS
APPLICATION B APPLICATION A APPLICATION B APPLICATION B APPLICATION C
Mixed Criticality Challenges
implemented,
system under a certain fault model
Example 1: UAV
software:
power (SWAP) constraints
would drive separating criticalities
assurance for more critical functions
11.12.2012 Real-time Operating Systems 28
UAV criticality levels (examples)
Level Required to prevent Flight Critical
Mission Critical
Maintenance Critical • Inefficient use of the vehicle’s resources.
11.12.2012 Real-time Operating Systems 29
Example 2 ARINC 653
An Avionics Standard for Safe, Partitioned Systems
System (RTOS) interface for avionics equipment
partitioning ARINC 653 approach allocates a predefined faction of CPU time and memory of the whole system to each partition
Avionics (IMA).
http://www.computersociety.it/wp- content/uploads/2008/08/ieee-cc- arinc653_final.pdf
11.12.2012 Real-time Operating Systems 31
http://www.computersociety.it/wp- content/uploads/2008/08/ieee-cc- arinc653_final.pdf
11.12.2012 Real-time Operating Systems 32
http://www.computersociety.it/wp- content/uploads/2008/08/ieee-cc- arinc653_final.pdf
11.12.2012 Real-time Operating Systems 33
Example 3: Synthetic Vision
11.12.2012 Real-time Operating Systems 34
Cost-Benefit ratio of an RTOS
by an average of 4.1 months
($321,250) * 0.42 * 4.1 = $553,200
Comparison RTOS – No OS
http://www.rtos.com/PDFs/EMFWhitePaper-RTOSSelection.pdf
RTOS market shares
fueled by the rise of 32-bit microprocessors
users to 19% for 8-bit controllers
http://www.eetimes.com/discussion/other/4025539/Embedded-systems-survey-Operating-systems-up-for-grabs 11.12.2012 Real-time Operating Systems 38
Market data for 2004 on tools and services
Characteristics Market (2004) Market volume in million € Market growth Largest consuming region and its share Largest consuming sector and its share Embedded OSs, bundled tools, related services 712.6 20.9% Americas 52.7% Consumer Electronics 41.7% SW development tools, related services 195.1 1.8% Americas 48.2% n.a. Design automation tools, related services 275.6 n.a. Americas n.a. Military / Aerospace, n.a. Test automation tools, related services 65.7 19.8% Americas 50.8% Military / Aerospace, 27.6% 1,249.0 17.0% (weighted average)
11.12.2012 Real-time Operating Systems 40
Linux as real-time operating system (1)
delay a even a high priority task‘s start time.
(Since 2.6 O(1) scheduler introduced: time to schedule is both fixed and deterministic regardless of the number of active tasks)
requires exclusive access to resources and internal data structures in order to maintain their consistency
Linux as real-time operating system (2)
indeterministic delays (jitter). Real-Time applications may not use the virtual memory
real-time apps (e.g., a typical control loop task executes with 100 Hz = every 10ms)
The Real-Time Preemption Patch
priority scheduling. There is also an EDF patch for Linux.
use real-time mutexes, including a priority inheritance protocol
[SCHED_DEADLINE, http://www.evidence.eu.com/content/view/313/390/]
The Dual-kernel Approach
Solutions to run hard-real time tasks and Linux:
(RTLinux)
Application Interface (RTAI)
11.12.2012 Real-time Operating Systems 44
RTLinux & RTAI
interrupt control between the hardware and the operating
Linux kernel using an associated real-time API
RTLinux & RTAI
prevents threads to be swapped-out and also the number of TLB misses is reduced.
(i.e. ring level 0 in i386 arch), have full access to the underlying hardware.
"single" execution space, system call mechanism is implemented by means of a simple function call (default is software interrupt which produces higher overhead).
Xenomai
RTAI spin-off, designed for
Task can switch transparently
Skins can emulate RTOS APIs
11.12.2012 Real-time Operating Systems 47
11.12.2012 Real-time Operating Systems 48
RTOS Trends
“Mil-aero systems require more and more functionality often found in traditional desktop operating systems rather than traditional real-time
advanced networking, and disk and SSD storage” Robert Day, vice president of marketing at LynuxWorks Inc. “Mil-aero systems require more and more functionality often found in traditional desktop operating systems rather than traditional real-time
advanced networking, and disk and SSD storage” Robert Day, vice president of marketing at LynuxWorks Inc. Security of network, security of information and data, and access controls and secure logins are now often specified as part of the functionality of the RTOS and its associated stacks. Separation kernels, partitioned operating systems, and secure operating systems are now being mandated for programs.“ Robert Day, vice president of marketing at LynuxWorks Inc. Security of network, security of information and data, and access controls and secure logins are now often specified as part of the functionality of the RTOS and its associated stacks. Separation kernels, partitioned operating systems, and secure operating systems are now being mandated for programs.“ Robert Day, vice president of marketing at LynuxWorks Inc.
11.12.2012 Real-time Operating Systems 49
Conclusion
application developers
software development
systems
commercial products
11.12.2012 Real-time Operating Systems 50
11.12.2012 Real-time Operating Systems 51
Demonstration: PWM signal generation
See http://veter-project.blogspot.co.at/2011/09/real-time- enough-about-pwms-and-shaky.html
11.12.2012 Real-time Operating Systems 52