Presentation on theme: "Commercial Real-Time Operating Systems Lecture 24"— Presentation transcript:
1 Commercial Real-Time Operating Systems Lecture 24
2 Outline Standards Metrics RTOSs VxWorks Embedded Windows platforms Linux extensions…
3 (Traditional) Real-Time Applications Transportation systemsAutomotives, avionics, railway system, submarines, …Space-based systemsSatellite systems, planetary rovers, …Industrial AutomationManufacturing automation (e.g. Bottling factories)Process control (e.g. petroleum refinement, temperature control systems, …)Motion controlRobotics applications, mechanical pets, …Data Acquisition systemsSupervisory control and data acquisition systems (SCADA), Security monitoring systemsDefense/military systemsRadar systems, Smart weapons, …+
4 Emerging Applications Cell-phones, VoIP phone, PDA’sMP3 playersSet-top boxes, Game ConsolesAutomotive SystemsNetwork ElementsWeb Servers
5 Popular Standards Real-Time Operating System standards IEEE b POSIX Real-Time Extensions (www.ieee.org)OSEK (automotive real-time OS standard) (www.osek.org)Real-Time (and Concurrent) Programming LanguagesReal-Time Specification for Java (www.java.com,Ada 83 and Ada 95Real-Time MiddlewareReal-Time CORBA (middleware and abstraction of the underlying RTOS)Networks/busesCANbus (Controller Area Network bus)TTA: Time-Triggered Architecture (www.tttech.com)FlexRay (www.flexray.org)ATM or Switched EthernetPriority-based or weighted fair-sharing schemes
6 Metrics in Real-Time Systems (1/2) End-to-end latency:E.g. worst-case, average-case, variance, distributionCan involve multiple hops (across nodes, links, switches and routers)Behavior in the presence or absence of failuresJitterThroughput:How many X can be processed?How many messages can be transmitted?Survivability:How many faults can be tolerated before system failures?What functionality gets compromised?
7 Metrics in Real-Time Systems (2/2) Security:Can the system’s integrity be compromised?Can violations be detected?Safety:Is the system “safe”?Can the system get into an ‘unsafe’ state? Has it been ‘certified’?Maintainability:How does one fix problems?How does the system get upgraded?Dynamism and Adaptability:What happens when the system mission changes?What happens when individual elements fail?Can the system reconfigure itself dynamically?How does the system behave after re-configuration?
8 RTOS Considerations What processor(s) does it run on? 8-bit, 16-bit, 32-bit, …Intel Pentium® Processor, PowerPC, Arm/StrongArm Intel Xscale®, MIPS, SuperH, …IBM and Intel® Network ProcessorsWhat board(s) does it run on?Complete software package for a particular hardware board is called a BSP (Board Support Package)What is the software environment?Compilers and debuggersIDECross-compilation + symbolic debugging on target?Profilers (CPU, memory)Test coverage toolsNative simulation/emulation support?
9 Real-Time Operating Systems Windows platformsEmbedded XP, Windows CE, Pocket WindowsVxWorks from Wind River Systems (www.windriver.com)Linux variantsBlue Cat Linux (www.lynuxworks.com)(Embedded) Red Hat Linux (www.redhat.com)FSM RT-Linux (www.fsmlabs.com)Monta Vista Linux (www.mvista.com)TimeSys Linux (www.timesys.com)LynxOS (www.lynuxworks.com)QNX (www.qnx.com)Solaris real-time extensionsTRONEmbedded OS specification in JapanHas multiple profiles for different classes of devices
10 Common RTOS Features Utilities Bootstrapping support “Headless” operationDisplay not necessaryAPIs (Application Programming Interfaces)Multiple threads and/or processesFixed priority scheduling is most popularMutex/semaphore support likely with priority inheritance supportInter-process communicationsMessage queuesTimers/clockGraphics supportDevice driversNetwork protocol stack
11 Emerging RTOS Requirements Full-featured operating systemSupport for new processors and devicesSupport for Internet protocols and standardsSupport for Multimedia protocols and standardsSupport for File SystemsMemory protectionResource protection, securityDevelopment tools and librariesGUI EnvironmentDo this with low and predictable overheads.
13 Why Linux? Reliable, Full-featured Operating System Rich multi-tasking supportSecurity, ProtectionNetworking SupportTCP/IP, RSVP, SIP, MPLS, H.323Multimedia SupportJPEG, MPEG, GSMDevice DriversStandard, Known Environment and API’sUnix LineageFamiliar environment for many users/developersPOSIX Compliance
14 Why Linux? The Cost Factor The Open Source Factor Free run-time royaltiesThe Open Source FactorA global team of programmers enhancing the environment literally all the timeAvailability of libraries, tools, and device driversSource Code Access allowing “peeking inside the hood” (and customizing as necessary)The Popularity FactorExcellent textbooks and documentation
15 Why Linux? Small Embedded Systems High-End Embedded Systems Modular Kernel, possible to configure the kernel to suitable sizeCustomizable Root File SystemLots of UtilitiesHigh-End Embedded SystemsHigh-AvailabilityClusteringSMP Support
16 Linux API: Tasking Process Threads Encapsulates a thread of control and an address spaceAddress space may be shared giving threads in effectSchedulable EntityThreadsAre processes to the Linux kernelScheduled by the Linux kernelCan be created such that they share the address space with the parent process, effectively giving threads
17 Linux API: POSIX, SVR4, BSD POSIX b (Real-Time Extensions)Priority SchedulingMemory LockingClocks and TimersReal-Time SignalsPOSIX c (Thread Extensions)Using pthreads libraryThread creation, destruction, etc.Mutexes, Condition VariablesSVR4 IPCShared MemorySemaphoresNetworking:BSD Sockets
18 Linux Internals Architecture ModulesmmvfsProcessScheduleripcnetDeviceDriversCore Mechanisms
19 The Real-Time Linux Challenge How to leverage the advantages of Linux, while making it suitable for real-time systems?
20 Approaches to Real-Time Linux Approaches limiting Real-time and Non Real-time Task InteractionsCompliant Kernel ApproachLynxOS/Blue Cat LinuxThin Kernel ApproachRTLinux/RTAIApproaches that integrate Real-time and Non Real-time tasksCore Kernel ApproachTimeSys Linux, Monta Vista LinuxResource Kernel ApproachTimeSys Linux
21 Linux Internals: Scheduling Schedulable EntitiesProcessesReal-Time Class: SCHED_FIFO or SCHED_RRTime-Sharing Class: SCHED_OTHERReal-Time processes haveApplication defined priorityHigher priority than time-sharing processesNon Schedulable EntitiesInterrupt HandlersHave priorities, and can be nestedBottom Halves & Task QueuesRun on schedule, ret from system call, ret from interrupt
22 Linux and Real-Time: Problems Timer GranularityMany real-time tasks are driven by timer interruptsIn Standard Linux, the timer is set to expire at 10 ms intervalsScheduler PredictabilityLinux scheduler keeps tasks in an unsorted listRequires a scan of all tasks to make a scheduling decisionScales poorly as number of tasks increases, and is especially poor for real-time performanceVarious subsystems NOT designed for real-time useNetwork protocol stackFilesystemWindows manager
23 Approaches to Real-Time Linux Compliant Kernel ApproachDual Kernel ApproachCore Kernel ApproachResource Kernel Approach
24 Compliant Kernel Approach Linux Development ToolsAnd EnvironmentLinux Development ToolsAnd EnvironmentLinux System Call APILinux System Call APILinux Kernel(Embedded Applications)Real-Time Kernel(Real-Time Applications)
25 Compliant Kernel Approach Basic ClaimLinux is defined by its API and not by its internal implementationThe real-time kernel is a non Linux kernelImplicationsNo benefits from the Linux kernelNot possible to benefit from the Linux kernel evolutionNot possible to use Linux hardware supportNot possible to use Linux device drivers
26 Compliance 100% Linux API Implications Support all of Linux kernel API Any Linux application can run on real-time kernelDevelopment can be done on Linux Host, with rich set of host tools for developmentAll Linux libraries are trivially available to run on real-time kernelThird party softwareAchieving 100% Linux API is non-trivialConsider the amount of effort put on Linux kernel development
27 Approaches to Real-Time Linux Compliant Kernel ApproachDual Kernel ApproachCore Kernel ApproachResource Kernel Approach
28 The Thin Kernel Approach LinuxProcessLinuxProcessUser-LevelKernel-LevelLinux KernelReal-TimeTaskReal-TimeTaskReal-TimeTaskReal-Time Kernel (RT-Linux or RTAI)HardwareReal-time tasks do NOT use the Linux API or Linux facilitiesFailure in any real-time task crashes the entire system
29 Approaches to Real-Time Linux Compliant Kernel ApproachDual Kernel ApproachCore Kernel ApproachResource Kernel Approach
30 Core Kernel Approach Basic Ideas Mechanisms Make the kernel more suitable for real-timeEnsure that the impact of changes is localized so thatKernel upgrades can be easily incorporatedKernel reliability and scalability is not compromisedMechanismsStatic ConfigurationCan be configured at compile timeDynamic ConfigurationUsing loadable kernel modules
31 Core Kernel ApproachAllows the use of most if not all existing Linux primitives, applications, and tools.Need to avoid primitives that can take extended time in the kernelAllows the use of most existing device drivers written to support Linux.Need to avoid poorly written drivers that unfairly hog system resourcesRobustness and ReliabilityCore kernel modifications can effect robustness, but source is available
32 Approaches to Real-Time Linux Compliant Kernel ApproachDual Kernel ApproachCore Kernel ApproachResource Kernel Approach
33 Resource KernelA Kernel that provides to Applications Timely, Guaranteed, and Enforced access to System ResourcesAllows Applications to specify only their Resource Demands, leaving the Kernel to satisfy those Demands using hidden management schemes
34 Protection in Resource Kernels Each application (or a group of collaborating applications) operates in a virtual machine:a machine which consists of a well-defined and guaranteed portion of system resourcesCPU capacity, the disk bandwidth, the network bandwidth and the memory resourceMultiple virtual machines can run simultaneously on the same physical machineguarantees available to each reserve set is valid despite the presence of other (potentially mis-behaving) applications using other reserve sets
35 “Resource Kernel” Architecture AppsReal-Time and Multimedia ApplicationsMiddlewareServicesPublisher/SubscriberServicesRT-ORBRT FilesystemQoS MgrReal-TimeJavaCPUMemoryNetBW...ResourceKernelPhysicalresourcesCPUMemoryNetBW
36 Linux Resource Kernel Architecture ProcessLinuxProcessLinuxProcessUser-LevelKernelResourceKernelLinuxKernelLKMHardware
37 Reserves and Resource Sets A Share of a Single ResourceTemporal ReservesParameters declare Portion and Timeframe of Resource UsageE.g., CPU time, link bandwidth, disk bandwidthSpatial ReservesAmount of spaceE.g., memory pages, network buffersResource SetA set of resource reserves
38 SummaryThe world of embedded real-time is changing, and converging with theDesktop world,The Enterprise world,The Server world,The Internet World, etc.There are 3 dominant platformsVxWorks (proprietary)Windows variantsLinux variants…