Group 9 Tittle:Real Time Linux Members: Lê Viết Hợp Biện Xuân Vĩnh 1 Real Time Linux Overview Real-Time System that has to perform its functions by responding to synchronous or asynchronous events within a specified amount of time. May be Soft RT – occasionally allowed to miss deadlines (eg. Updating a video display) Hard RT – Meeting the deadline is absolutely critical (eg. Rocket controller) 2 Real Time Linux Kenel Linux Real Time Linux 3 Linux is not Real Time The Linux kernel (< 2.6) is neither preemptive nor reentrant by user processes. Context switch takes several hundred microseconds. Insufficient resource handling. Scheduling algorithm designed not for real time. Unbound amount of CPU time used by interrupt handlers under Linux, and these run at a higher priority than any user process. 4 Real Time Linux Overview Real Time Linux Inspired by MERT (Bell Labs 1978) – a full-fledged Virtual Machine (VM) concept. It slips a small, simple, Real Time OS underneath Linux. Linux becomes an idle task for this OS. 5 Real Time Linux Implementation of Real Time Linux Basically, there are 2 ways to make Linux real time: Dual-Kernel: is to insert a new code layer between standard Linux Kernel and hardware layer. IEEE 1003.1d Kernel: is to implement some real-time extensions within Standard Linux Kernel such as timer, scheduling , preemtion logic, etc. 6 Real Time Linux Implementation of RT Linux(Contd.) In more detail, there are 4 strategies to modify standard Linux: Micro Kernel. Nano Kernel. Resource Kernel Extension. POSIX Real Time Extentions. 7 Real Time Linux Micro Kernel 8 Real Time Linux Nano Kernel 9 Real Time Linux Resource Kernel Extension 10 Real Time Linux Dual-Kernel Advantages Can make hard real time guarantees Easy to implement a new scheduler Disadvantages Initial port difficult, must know a tremendous amount about underlying hardware Running a small real-time executive is not a substitute for a full fledged RTOS 11 Real Time Linux POSIX Real Time Extentions Directly modify the standard kernel and provide libraries that together implement the POSIX realtime extensions. No second kernel in this approach. The patches are made directly to the standard kernel to implement the timers, signals, semaphores, process memory locking, shared memory, priority scheduling, synchronized and assynchronized I/O specified in IEEE 1003.1d. 12 Real Time Linux POSIX Real Time Extentions Advantages Most problems, such as interrupt handling, already solved Less initial labor Disadvantages No guaranteed performance RT tasks don’t always have precedence over non-RT tasks. 13 Real Time Linux Performance Comparison with other Real Time Kernel Performance Characteristics: Event Latency. Periodic Jitter. 14 Real Time Linux Real Time Linux RT Linux • Developed by Victor Yodaiken at the New • • • • Mexico Institute of Technology in 1996. An Open Source, Hard Real-Time Operating System. Based on Micro Kernel architecture. Was originally a research project.Became a FSM lab's commercial product. 2007, became Wind River Linux up to now. Real Time Linux 15 RTLinux's implementation • Implementation of a RT-linux plugin which: o Co-exists along with the Standard Kernel. o Is considered as a sitting layer between the Standard Kernel and Hardware layer. • The Standard Kernel sees RTLinux as an actual Hardware. • Within the RT-linux plugin,there are: o The RT-schedulers for scheduling RT tasks and Linux Kernel. o The tool which generates RT FIFO for IPC. 16 Real Time Linux RT Linux's Scheduling • Real-time tasks can be configured by user within a specific • • • • • • scheduler and priority. Real-time tasks executed by RT kernel. Real-Time tasks are set with the highest priority values. The RT Kernel allows users to create their own schedulers. So far, there have been 2 schedulers : o Priority based preemptive. o EDF based. Allows users to set priorities for each task. Standard Kernel is assigned the lowest priority among the RT tasks. Supporting: FIFO, Shared Memory and Semaphore in IPC. 17 Real Time Linux RTAI The Linux RT • Real-Time Application Interface • Implemented by staff at Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano, Italy. • An open-source project. • Originally based on RT Linux. • Based on Real-Time Hardware Abstraction Layer (RTHAL). 18 Real Time Linux RTAI's implementation • Implementation a RTHAL within Linux Kernel. RTHAL is: o Real Time Hardware Abstraction Layer. o Implemented to communicate with the Real-time Kernel. • Implementation Real-time Kernel which: o Co-exist along with the Linux Kernel. o Is placed between hardware and Linux Kernel. • FIFO is also implemented. Real Time Linux 19 RTAI's scheduling • • RTAI treats the Linux kernel as a low priority real-time task. Whenever a new task is added, it will be assigned higher priority than the Linux kernel. • The scheduler provides services which are used in various real-time operating systems: o Suspend. o Resume. o Yield. o Make periodic. o Wait until. • Schedulers: o UP (Uni-processor). o SMP (symetric multi-processor). o MUP (Multi-Uni-Processor). • Supporting: FIFO, Shared Memory, Semaphore,Message queue and Mail boxes in IPC. 20 Real Time Linux KURT • A Soft real-time Operating system, named Kansas University's • • • • Real-Time Linux. Developed at University of Kansas, started in 1997 Project in the Information and Telecommunications Technology Center. An implementation of the POSIX real-time extensions to Linux. Specified by IEEE 1003.1d. 21 Real Time Linux KURT's implementation • • • • Improving the resolution of the system clock to 10ms. Using the same mechanism for managing time as RT-Linux. Generating interrupt on demand. Modifying the scheduler to include new policy, SCHED_KURT besides those are defined by POSIX such as SCHED_FIFO, SCHED_RR,.... • Adding new system calls to implement real-time functionality. 22 Real Time Linux KURT's scheduling • KURT can’t guarantee priority of RT tasks over non-RT tasks • An RT task can be blocked by a non-RT task (eg: during disk I/O) leading to priority inversion • Suitable for soft RT systems. 23 Real Time Linux ADEOS The Adaptive Domain Environment for Operating Systems. • An open source, released in 2002. • A provision of the GNU GPL (The GNU General Public License) • A real-time framework which allows operating systems to be run in parallel. 24 Real Time Linux ADEOS's implementation • Providing a Hardware abstract layer sitting over the hardware layer. • Yet, it does not implement RT Kernel. • Providing a mechanism which allows interruption of RT OS with possible priority. 25 Real Time Linux Linux/RK A Portable Resource Kernel in Linux. • A resource kernel based on Linux. • Developed by the Real-time and Multimedia Systems Laboratory ,in1998. • Led by Dr. Raj Rajkumar at Carnegie Mellon University. 26 Real Time Linux Linux/RK's implementation • Adding a resource kernel which is a real-time kernel (operating system) that : o Provides to applications Timely Guaranteed, and Enforced access to System Resources o Allows Applications to specify only their Resource Demands leaving the Kernel to satisfy those Demands using hidden management schemes • Providing a tool that allows user to request, reserve, and be guaranteed a nite percentage of machine resources 27 Real Time Linux References 1. 2. 3. 4. 5. 6. 28 Real-time linux report v2.0.0, by Aeolean Inc in NIST (Intelligent Systems Division National Institute of Standards & Technology). http://www.aero.polimi.it/projects/rtai/contrib.htm Adaptive Domain Envioronment for Oprerating Systems, by Karim Yaghmour. http://www.linuxsymposium.org/archives/OLS/Reprints-2001/yaghmour.pdf Linux/RK: A Portable Resource Kernel in Linux, by Shuichi Oikawa and Ragunathan Rajkumar. CS397 Ambuj and Utkarsh Feb 2000 Real Time Linux Thank you! Q&A 29 Real Time Linux