Open Source Real-Time Operating Systems Overview

Open Source Real-Time Operating Systems Overview

8th International Conference on Accelerator & Large Experimental Physics Control Systems, 2001, San Jose, California WEBI001 cs.OS/0111035 OPEN SOURCE REAL TIME OPERATING SYSTEMS OVERVIEW ∗ T. Straumann, SSRL, Menlo Park, USA Abstract System Architecture The basic idea of RTL is striking simple: A slim layer of software is “hooked” into standard Modern control systems applications are often built on top Linux’ interrupt handlers and interrupt enabling/disabling of a real time operating system (RTOS) which provides the primitives, thereby effectively taking over the machine necessary hardware abstraction as well as scheduling, net- which is then managed by a special real-time scheduler. working and other services. Several open source RTOS Linux continues to run as a low priority task. solutions are publicly available, which is very attractive, The real-time core manages all hardware interrupts, dis- both from an economic (no licensing fees) as well as from a patching them appropriately, either to Linux or to real-time technical (control over the source code) point of view. This threads. The interrupt manager never allows Linux to dis- contribution gives an overview of the RTLinux and RTEMS able interrupts. Instead, Linux disabling an IRQ actually systems (architecture, development environment, API etc.). invokes an RTL hook which marks the target interrupt as Both systems feature most popular CPUs, several APIs (in- “disabled”. If the interrupt manager detects such a marked cluding Posix), networking, portability and optional com- IRQ, it holds off dispatching it to Linux until the correspond- mercial support. Some performance figures are presented, ing call to re-enable the IRQ in question is intercepted. focusing on interrupt latency and context switching delay. Linux being a low priority task with no direct access to the interrupt hardware implies that any real-time thread in- 1 INTRODUCTION troduced into the system can only very weakly interact with Apart from hard-real time interrupt handling and schedul- Linux (through special communication channels) and may ing services, there are other OS features of interest, such only build upon the services of the RTL core, such as syn- as the available APIs, target CPU architectures and BSPs chronization primitives and the scheduler. Note that this (board support packages), support for multiple processors, low-level environment does not provide a C or “math” li- networking, file systems, dynamic object loading, memory brary nor any of Linux’ standard system services like net- protection and so on. working, file systems or drivers. While the former (C li- Other important issues are licensing terms, development brary) functionality is easy to add, providing the latter is far environment and debugging tools and the availability of more complex for obvious reasons. Communication with these tools for specific host platforms. user space processes is established through special “real- The next section gives an overview of RTL and RTEMS time fifo” devices. looking at some of these issues. In section 3, some perfor- Following the philosophy of RTL, most of an application mance measurements are presented comparing the results should be implemented in user space, as ordinary Linux for RTL and RTEMS to a commercial system (vxWorks). programs. Only the real-time critical tasks go into a special module which is loaded into kernel memory using Linux’ standard kernel-module loader. 2 RTLINUX AND RTEMS OVERVIEW 2.1 RTLinux API and General Features Version 3.1 of RTL offers (a subset of) the POSIX (1003.13) “pthreads”, semaphores, General Information RTL development started at the condition variables and a proprietary interface to the inter- New Mexico Institute of Mining and Technology and is now rupt subsystem. As already mentioned, no C-library is pro- maintained by FSMlabs Inc. which also offers commercial vided per-se. RTL special features include periodic schedul- support. The basic mechanism is protected by a US patent; ing with high timing resolution. RTL (having a license for using the mechanism) itself is While high timing resolution is certainly desirable, its licensed under the terms of the GPL. usefulness is reduced to some degree by the relatively high RTL is distributed as a patch against certain versions of latencies (see measurement section). Linux and a collection of kernel modules. As a consequence of the layered system architecture with Further information about RTL is available at [1]. Linux on top of the RTL core, an RTL application must be ∗ Thanks to Ric Claus for kindly borrowing me the MVME2306 com- carefully separated into real-time critical and non-critical puter parts. Only the latter may use the powerful features of 235 8th International Conference on Accelerator & Large Experimental Physics Control Systems, 2001, San Jose, California Linux, both in kernel or user space. Critical tasks must As in vxWorks, memory protection is not available; the not e.g. write files or access non-RT drivers but they must system and application software share the same, flat mem- delegate this work to non-real time code. ory space. RTEMS itself does not ship a shell as powerful as vx- Supported Target Architectures RTL supports a sub- Works’ nor does it offer a dynamic loader. However, there set of the CPUs and platforms supported by Linux. x86, are ongoing efforts of creating application programs pro- PowerPC,Alpha and MIPS are currently supported by RTL; viding the respective features. at least on x86, SMP is supported. The only file systems currently implemented are a remote TFTP and a “in memory” (ramdisk) file system. Development Environment RTL development is usu- ally done using the well-known GNU tool chain which has Supported Target Architectures RTEMS is designed been ported to a wide variety of host platforms. The RTL to be easily portable and consequently it supports many CPU core provides support for debugging real-time modules. architectures, such as m68k, ColdFire, Hitachi SH, Intel i386, Intel i960, MIPS, PowerPC, SPARC, AMD A29k and 2.2 RTEMS HP PA-RISC. General Information RTEMS stands for “Real Time Executive for Multiprocessor Systems”, where the original Development Environment RTEMS uses the GNU meaning of the letter M, namely “Missile” and later “Mili- tool chain. tary” has eventually reached a civilian status. RTEMS was developed by OaR Corp. on behalf of the 3 RESPONSE TIME PERFORMANCE US DoD and is licensed under a GPL variant. OaR coor- TEST dinates development efforts and offers commercial support for RTEMS and other related services. A key property of any hard-real time system is its “response RTEMS has reached production quality and is used by time”, i.e. the time it takes for the system to react to some military, industrial and scientific projects. EPICS, a control external event under worst case conditions. Two important systems software which is widely used in the accelerator terms shall be defined here: community, has been ported to RTEMS as of the new 3.14 EPICS release. “Interrupt Latency” The time it takes from a device as- More information about RTEMS can be found at [2]. serting an interrupt line until the system dispatching the corresponding interrupt handler (ISR) shall be called System Architecture RTEMS was designed as a true interrupt latency. RTOS from scratch, targeting embedded systems, possibly “Context Switch Delay” This term defines the time it with less memory. Consequently, various system compo- takes to schedule a task. It involves the scheduler de- nents are partitioned into separate modules (“managers” in termining which task to run, saving the current task RTEMS terminology) which are linked to the application as context and restoring the new one. needed. The system can further be tailored to an applica- tion’s specific needs by choosing appropriate configuration Of course, it is practically impossible to find the worst case parameters. conditions given the huge number of possible state combi- A typical RTEMS application is built by compiling the nations that can occur in a computer system. application itself, which must provide the necessary con- Therefore, a statistical approach is taken to create “worst figuration parameters, and linking it to the desired RTEMS case” conditions. The idea is to let the system operate under managers (which are provided in libraries) thereby creat- heavy load for some time while measuring the latencies. ing an executable for downloading to the target system or The maximal delay recorded during the test is then assumed burning into ROM etc. to reflect the “worst case”. Since RTEMS is an RT system “from the ground up”, all system services and libraries are directly available to any 3.1 Test Algorithm application task. A PowerPC 604 CPU (300MHz) on a MVME2306, PReP API and General Features RTEMS features POSIX compatible board by Motorola was chosen to perform the (1003.1b), ITRON and “classic/native” APIs in C and ADA measurements. BSPs for RTL, RTEMS and VxWorks were (native API only) language bindings. The usual com- available, allowing for comparison of the three systems on ponents of an RTOS are available, such as multitasking the same target hardware. (thread creation and control), synchronization primitives The MVME2306 (like most PPC platforms) features (mutexes, semaphores, message queues, events etc.), sched- timer hardware with a reasonable resolution, which can be ulers (fifo/round robin, rate monotonic), clocks etc. set up to generate periodic interrupts. Because the running RTEMS provides a port of the BSD TCP/IP networking timer is readable “on-the fly”, a precise measurement of stack and supports multiple (possibly heterogeneous) CPUs. latencies can easily be accomplished. 236 8th International Conference on Accelerator & Large Experimental Physics Control Systems, 2001, San Jose, California The test software package [3] consists of an initialization Interrupt Latency Context Switching routine, an interrupt handler (ISR) and a simple “measure- max avg±σ max avg±σ ment” procedure.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us