1 / 27

Resource Kernels: Linux/RK

Resource Kernels: Linux/RK. Raj Rajkumar, Kanaka Juvva, Anastasio Molano and Shui Oikawa, “Resource Kernels: A Resource-Centric Approach to Real-Time Systems”, In Proceedings of the SPIE/ACM Conference on Multimedia Computing and Networking, January 1998. Before we start…. Unix Scheduling

ulf
Download Presentation

Resource Kernels: Linux/RK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Resource Kernels: Linux/RK Raj Rajkumar, Kanaka Juvva, Anastasio Molano and Shui Oikawa, “Resource Kernels: A Resource-Centric Approach to Real-Time Systems”, In Proceedings of the SPIE/ACM Conference on Multimedia Computing and Networking, January 1998.

  2. Before we start… • Unix Scheduling • Mainly for time-sharing • Multilevel feedback queue • Each queue applies Round Robin scheduling • Priority varies dynamically, e.g., aging

  3. Linux Scheduling • Provides RT-POSIX interface • Fixed priority real-time scheduling classes • SCHED_FIFO • SCHED_RR • 100 priority levels • Timesharing in SCHED_OTHER • Relatively new preemptive Linux kernels • Enough support for real-time applications?

  4. Extend Linux for real-time support • Why extend Linux? • A large user base • Open-source • But, is the Linux footprint small enough for embedded applications?

  5. Disk BW CPU NetBW Resource Kernel • A Kernel that provides to applications Timely, Guaranteed, and Enforced access to System Resources • Allows Applications to specify only their Resource Demands • leaving the Kernel to satisfy those Demands using hidden management schemes Task 2 Reservation Parameters “T”: Period (1/f) “C”: Execution time within period “D”: Deadline within period Task 3 Task 1 Resource Set Rsv 1 Rsv 2 Rsv 3 Source: Dr. Rajkumar at CMU

  6. Linux/RKArchitecture Linux Process Linux Process Linux Process User-Level Kernel Resource Kernel Linux Kernel Kernel Loadable Kernel Module Hardware Source: Dr. Rajkumar at CMU

  7. Diversion: RTLinux • Open source Linux project: • www.fsmlabs.com • http://tldp.org/HOWTO/RTLinux-HOWTO.html • Supports x86, PowerPC, Alpha • Available as a patch to the regular Linux kernel • Provides an RT API for developers • Runs Linux kernel as lowest priority process Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  8. Linux Kernel User Processes System libraries Linux kernel Device drivers I/O Hardware Interrupts Hardware Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  9. RTLinux Kernel Linux is executed in the background User Processes Real Time Tasks System libraries Linux kernel Device drivers I/O Software Interrupts Direct h/w access RTLinux Plug-in RT-Scheduler I/O Hardware Interrupts Hardware Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  10. Linux Kernel: code perspective THE controller User Process Kernel Loadable Modules Module M2 service (system call) M1 M2 M2 Linux Monolithic kernel core M3 M4 RAM DISK Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  11. RTLinux Kernel: code perspective THE controller RT Load command RT core Kernel Loadable Modules Load RTcore RTM2 RTM3 Linux Monolithic kernel core M1 M2 RT-Core Module M3 RAM DISK Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  12. Getting RTLinux ready • Configure and compile a fresh Linux kernel (2.4.29) • Download the kernel from http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.29.tar.gz • Patch the RTLinux to the Linux kernel • Recompile the kernel and reboot the system into the new kernel • Configure the RTLinux kernel and compile it Source: Cpre 458/558 by Dr. Manimaran at Iowa State University

  13. Linux/RK Abstractions CMU’s Linux/RK supports several abstractions and primitives for real-time scheduling of processes with real-time and QoS requirements: • Resource reservations with latency guarantees • CPU cycles • Network bandwidth • Disk bandwidth • Support for periodic tasks. • Support for 256 real-time fixed-priority levels. • High-resolution timers and clocks. • Bounding of priority inversion during synchronization operations • Also works with reservations (reservation inheritance, etc.) • Wiring down of memory pages. Source: Dr. Rajkumar at CMU

  14. Reservation Types • Hard reservation: On depletion, it cannot be scheduled until it is replenished • Firm reservation: On depletion, it can be scheduled if no other undepleted reservation or unreserved threads are ready to run • Soft reservation: On depletion, it can be scheduled with other unreserved threads and depleted reservations

  15. Hard reservation

  16. Firm reservation

  17. Soft reservation

  18. Scheduling & Admission Control • Each reservation receives a fixed priority according to period (RMS) or deadline (DMS) • Admission control overhead

  19. Disk Scheduling • Traditional RT systems avoided to use disk • Unpredictable latencies • Disk access requests should be scheduled in conjunction with the processor scheduling • Multiple resource problem with deadlines is NP-complete [5] • Disk bandwidth reservations in addition to CPU cycle reservations • EDF: Pick the reservation with the earliest deadline • Immediate preemption of a disk access is impossible • EDF is not optimal in a non-preemptive model • A lot of disk head movements • EDF + Just-in-time scheduling • High priority tasks may finish early • Exploit “slack” to serve requests close to the current head position, similar to SCAN

  20. Workload with both CPU and Disk requirements

  21. Resource kernel and QoS Support guaranteed, timely and enforced access to CPU cycles and network bandwidth SMP support with QoS Reservations Fully preemptive kernel Fixed-priority scheduling (POSIX-compliant) High-resolution timer and clock support (microsecond resolution) Periodic processes Message queues Priority inheritance and priority ceiling protocol emulation support to avoid unbounded priority inversion Commercialized Linux/RK: TimeSys Linux SuiteTime tools App App RT-App RT-App Real-Time Java TimeSys Linux/RT Source: Dr. Rajkumar at CMU TimeSys Corporation

  22. TimeSys Linux • TimeSys Linux/GPL • Basic TimeSys Linux kernel • Full preemption at the kernel level, prioritized interrupt handlers, unlimited priorities, ... • TimeSys Linux/Real-time • Support priority inheritance and a POSIX-based high-resolution timer API • TimeSys Linux/CPU • Support CPU reservation, which gives a thread, process, or process group exclusive use of the CPU. • TimeSys Linux/Net • Support network bandwidth reservation to guarantee that your thread or process will get the bandwidth it requires, regardless of network activity in other processes • TimeSys Linux GPL: Downloadable from sourceforge.net/projects/timesysgpl • TimeSys Linux Install mini HOWTO: http://doc.ece.uci.edu/~tharmon/files/TimeSys-Linux-Install-mini-HOWTO.html

  23. #Priority levels and EDF • EDF is hard to implement because most operating systems only support a fixed number of priority levels (typically <= 256) • Deadline scheduling, e.g., EDF, can be better fixed priority scheduling which is oblivious to deadlines • Example: Consider the following scenario in RMS TH DH TL DL

  24. Fixed priority vs. Dynamic priority • Fixed priority • Supported by most kernels • Simple & little overhead • Low utilization bound • RMS: 0.69 • Dynamic priority • Deadline is the first class citizen • High utilization bound: 1 in EDF • Limited priority levels in most kernels • More complex; High overhead

  25. Average kernel preemption latency comparison Source: http://linuxdevices.com/articles/AT6106723802.html

  26. Others • Unix-based: QNX, LynxOS, … • Proprietary: pSOS, VxWorks, VRTX, … • More recently • eCos • L4 • μcOS-II

  27. Announcement: Midterm Exam • Midterm Exam on Oct. 12, 2006 for both on-campus and EngiNet students • Format: In-Class, Closed-book, Closed-note exam • Study Real-Time Scheduling, Synchronization, and Real-Time Operating Systems covered up to today’s lecture • Focus on my lecture slides (supplemented by the papers on the reading list) • From Oct. 2, we will discuss RTDB – Read paper [D1] in the reading list

More Related