Small-footprint and Real-time Linux-esOperating System (OS) goalsWhat is out there?uClinux detailsSoft Real-Time Linuxes detailsWhen is Hard Real-Time needed?RTLinux: The Real Time LinuxRTLinux: MicrokernelRTLinux: Microkernel (cont.)RTLinux: Microkernel DetailsRTLinux: Real-Time TasksRTLinux vs. RTAIPriority Inversion and RTLinuxReferencesSmall-footprint and Real-time Linux-esAthanasios StathopoulosVladimir BychkovskiyOperating System (OS) goalsGeneric operating systems goalsprovide high level abstractionsimplicity of usefairness in schedulingapplication independencesome quality of service (QoS)Real-Time and Embedded OS goalsvery low latency (“real-time”) responsedeterminismsmall-footprintWhat is out there?Open SourceMicrocontroller (no MMU) OSes:uClinux - small-footprint LinuxQoS extensions for desktop:Linux-SRT and QLinux soft real-time kernel extensiontarget: media applications Embedded PCRTLinux, RTAI hard real time OSfully compatible with GNU/LinuxCommercial:vxWorks, QNX, HardHat Linux, WinCE, etcuClinux detailsProvidesCommon Linux APIFull TCP/IP stackPopular filesystems supportSupported platformsOriginally developed for Motorolla 68KLarge number of platforms currently supportedSpecial featuresKernel size < 512kbLimited multitaskingDesigned for portabilitySoft Real-Time Linuxes detailsLinux-SRTSingle QoS scheduler guarantees a CPU % for an application.Special features:real-time X server that prioritizes rendering based on scheduling parametersSupported platforms:same as main stream linuxSummary:User-orientedQLinuxCPU % guaranteed to groups using hierarchical scedulersSpecial features:additional schedulers for network, disk devicesSupported platforms:same as main stream linuxSummary:Research-orientedWhen is Hard Real-Time needed?Hard vs. Soft Real-TimeHard RT always guarantees exact timingHard Real-Time applicationsClosed-loop control systemsStimulus/response systemsExamplesRobotics, AnimatronicsIndustrial equipmentNeural, fuzzy and adaptive systemsHowever:Hard Real-Time extensions can degrade OS performance of non time-critical applicationsRTLinux: The Real Time LinuxGoalsmaintain compatibility with GNU/Linuxhandle tasks with hard-real time constrainssimplicity and reliability of the RTtradeoff: ease of useApproachreal-time microkernelLinux kernel is running as lowest priority task in the real-time schedulereal-time applications are written as microkernel modulesmicrokernel is transparent to regular applicationRTLinux: MicrokernelMicrokernelIS a thin layer of abstractionPROVIDES an interface for hardware interrupts and API for real-time tasksMEDIATES requests to/from hardwarePicture from www.embedded.com website.RTLinux: Microkernel (cont.) ComponentsProcessor clock controlReal-Time schedulerPOSIX-like interface to device driversReal-Time FIFOs Shared memory buffersPOSIX-like IPCBlocking mutexesSemaphoresSource-level debugger supportSerial port interfaceRTLinux: Microkernel DetailsSchedulerPreemptive, priority basedHardware context switch is not usedReason: saves too much state, not fast enoughStack is used insteadRT kernel handles hardware interruptsLinux thread does not directly receive themWhen Linux wants to disable interruptsThe microkernel stops passing them to the Linux threadHowever, real-time tasks can receive themRTLinux: Real-Time TasksRT kernel modulesTake advantage of microkernel’s RT APICan provide a device-like interface (RTFIFO) for non real-time tasksCan share devices with non real-time tasks RT tasks always get serviced firstExample: Dual Data AcquisitionPicture from www.embedded.com website.RTLinux vs. RTAIRTAI is based on RTLinuxHowever, design philosophy differsRTAI: Focused on adding new featuresEasier to useCaveat: performance hitRTLinux: RTOS must be very fastAny additional functionality must be optionalMicrokernel must remain “micro”Platform supportRTLinux: x86, Alpha, PPC, Linux v. 1.3-2.4RTAI: x86, Linux v. 2.2Priority Inversion and RTLinuxUnlike most RTOS’s RTLinux does not attempt to solve the priority inversion problem.“I think that priority inheritance is for people who want to build complex critical real-time systems that sometimes work.”, Victor Yodaiken, RTLinux author. Author suggests: “… use well known, time-tested methods such as flip buffers and message queues (or RTfifos).”Another proposed solution is to disable microkernel thread switching while semaphores are heldThis approach is similar to priority ceiling However: System will give up multitasking capabilities inside critical sections.ReferencesuClinux Home page, http://www.uclinux.orgSRT-Linux Home page, http://www.uk.research.att.com/~dmi/linux-srt/QLinux Home page, http://www.cs.umass.edu/~lass/software/qlinux/Ivchenko, A. “Real-Time Linux”, Embedded System Programming, May 2001RTLinux Home page, http://www.rtlinux.orgRTLinux FAQ, http://www.rtlinux.org/documents/faq.html“RTLinux: An interview with Victor Yodaiken”, http://www.acm.org/crossroads/xrds6-1/yodaiken.htmlRTAI, http://opensource.lineo.com/rtai.htmlSha, L.; Rajkumar, R.; Lehoczky, J.P. Priority inheritance protocols: an approach to real-time synchronization. IEEE Transactions on Computers, vol.39, (no.9), Sept. 1990. p.1175-85.
View Full Document