Professional Documents
Culture Documents
RT Linux
RT Linux
What is real-time? realCorrectness of output depends on timing as well as result Hard vs. soft real-time realAre Windows and Linux real-time? real-
Typical RTS
RTOS
GPOS
So what happens in the case a Hard Real Time System does not meet a deadline? Failure!
Why RTOS?
Interactive embedded systems require real time scheduling Some legacy OS can provide some of this functionality BUT they are too big to run on an embedded systems
Basic memory management Interrupt handling Timer handling, time management Implementable on small deeply embedded systems
Real ti e I tr ti Li x as g RT platf r
Excellent stability and efficiency Source code availability Active license, and substantial user base. Linux can run on the most widely available computers Linux has all features of a modern UNIX system: (X Window, graphical user interface toolkits, networking, databases, programming languages, debuggers, and a variety of applications). It is embeddable and is able to perform efficiently using relatively small amounts of RAM and other computer resources.
Real ti e I tr ti Li x as g RT platf r
In short, Linux has the potential to make an excellent development platform for a wide variety of applications, including those involving real-time processing. real-
Defects of Linux
Linux scheduling algorithms are not designed for realrealtime tasks. Linux scheduling is unpredictable. Linux Timer resolution is coarse, 10 ms. Linux Kernel is Non-preemptible . NonLinux disables interrupts used for coarse-grained coarsesynchronization. Linux uses virtual memory. Linux reorders requests for efficiency (e.g., for disk I/O).
Virtual memory
Introduces unpredictable amount of delays
Variable priority
Each task is assigned a priority which varies over the time; this is to achieve fairness
What is RTLinux ? ..
To support hard real time applications, the Linux kernel is modified by introducing a layer between the hardware and the standard Linux kernel. RTRT-Linux is a hard realrealtime kernel that runs Linux or BSD as an idle task, whenever there are no real-time demands. real-
RTRT-Linux
Additi nal layer between Linux al kernel and hardware.
exists with
RTRT-Linux is module oriented. Decouples the mechanisms of realrealtime kernel from the general purpose kernel.
Preemptive priority scheduling Locking of virtual pages into memory RealReal-time signals Improved IPC Improved timers
Linux only partially conforms to the above. (mlock and setsched system calls)
Linux Kernel
An RT - Process
Networking Graphics Windowing systems Data analysis packages Linux device drivers, and Standard POSIX API.
UTIME RTRT-Linux Platform Kurt Platform RED Linux RTAI Linux/RK(from Mac/RK)
MiniRTL
Extension to RT Linux
RTLinux Features
The RTLinux executive is itself nonpreemptible. Its routine are very small and fast, this does not cause big delays. Interrupts from Linux are disabled.
No virtual memory.
Architecture of RT Linux
Linux Kernel
User Processes
Linux kernel
Hardware Interrupts
Hardware
Scheduling algorithms (maximize throughput) Device Drivers. Uninterruptible System Calls. Use of interrupt disabling procedures.
Hard RT always guarantees exact timing ClosedClosed-loop control systems Stimulus/response systems Robotics, Animatronics Industrial equipment Neural, fuzzy and adaptive systems Hard Real-Time extensions can degrade OS Realperformance of non time-critical applications time-
Examples
However:
maintain compatibility with GNU/Linux handle tasks with hard-real time constrains hardsimplicity and reliability of the RT
tradeoff: ease of use
Approach
realreal-time microkernel Linux kernel is running as lowest priority task in the real-time schedule realrealreal-time applications are written as microkernel modules microkernel is transparent to regular application
RTLinux: Microkernel
Microkernel
IS a thin layer of abstraction PROVIDES an interface for hardware interrupts and API for realreal-time tasks MEDIATES requests to/from hardware
Processor clock control RealReal-Time scheduler POSIXPOSIX-like interface to device drivers RealReal-Time FIFOs Shared memory buffers POSIXPOSIX-like IPC
Blocking mutexes Semaphores
Preemptive, priority based Reason: saves too much state, not fast enough Stack is used instead Linux thread does not directly receive them The microkernel stops passing them to the Linux thread However, real-time tasks can receive them real-