A Programmable Microkernel for Real-Time Systems∗

A Programmable Microkernel for Real-Time Systems∗

A Programmable Microkernel for Real-Time Systems∗ Christoph M. Kirsch Marco A.A. Sanvido Thomas A. Henzinger University of Salzburg VMWare Inc. EPFL and UC Berkeley [email protected] tah@epfl.ch ABSTRACT Categories and Subject Descriptors We present a new software system architecture for the im- D.4.7 [Operating Systems]: Organization and Design— plementation of hard real-time applications. The core of the Real-time systems and embedded systems system is a microkernel whose reactivity (interrupt handling as in synchronous reactive programs) and proactivity (task General Terms scheduling as in traditional RTOSs) are fully programma- Languages ble. The microkernel, which we implemented on a Strong- ARM processor, consists of two interacting domain-specific Keywords virtual machines, a reactive E (Embedded) machine and a proactive S (Scheduling) machine. The microkernel code (or Real Time, Operating System, Virtual Machine microcode) that runs on the microkernel is partitioned into E and S code. E code manages the interaction of the system 1. INTRODUCTION with the physical environment: the execution of E code is In [9], we advocated the E (Embedded) machine as a triggered by environment interrupts, which signal external portable target for compiling hard real-time code, and in- events such as the arrival of a message or sensor value, and it troduced, in [11], the S (Scheduling) machine as a universal releases application tasks to the S machine. S code manages target for generating schedules according to arbitrary and the interaction of the system with the processor: the exe- possibly non-trivial strategies such as nonpreemptive and cution of S code is triggered by hardware interrupts, which multiprocessor scheduling. In this paper, we show that the signal internal events such as the completion of a task or E machine together with the S machine, form a program- time slice, and it dispatches application tasks to the CPU, mable, low-overhead microkernel for real-time systems. We possibly preempting a running task. This partition of the implemented the microkernel on a StrongARM SA-1110 pro- system orthogonalizes the two main concerns of real-time cessor and measured the system overhead to lie in the 0.2– implementations: E code refers to environment time and 0.3% range. The implementation has a very small footprint, thus defines the reactivity of the system in a hardware- and namely, 8kB. scheduler-independent fashion; S code refers to CPU time The E machine is woken up by external interrupts caused and defines a system scheduler. If both time lines can be by environment events, such as the arrival of a message on reconciled, then the code is called time safe; violations of a channel, or the arrival of a new value at a sensor. Once time safety are handled again in a programmable way, by awake, the E machine follows E code instructions to do three run-time exceptions. The separation of E from S code per- things: first, it may run some drivers for managing sensors, mits the independent programming, verification, optimiza- actuators, networking, and other devices; second, it may tion, composition, dynamic adaptation, and reuse of both release some application software tasks for execution; third, reaction and scheduling mechanisms. Our measurements it may update the trigger queue, which contains pairs of the show that the system overhead is very acceptable even for form (e, a) indicating that the future environment event e large sets of task, generally in the 0.2–0.3% range. will cause an interrupt that wakes up the E machine with ∗ its program counter set to the E code address a. Then, the This research was done while all authors were at UC Berke- ley and supported in part by the AFOSR MURI grant E machine goes back to sleep and relinquishes control of the F49620-00-1-0327 and the NSF grants CCR-0208875 and CPU to the S machine. The S machine is woken up by the CCR-0225610. E machine, or by internal interrupts caused by processor events, such as the completion of an application task, or the expiration of a time slice. Once awake, the S machine follows S code instructions to do three things: first, it takes Permission to make digital or hard copies of all or part of this work for care of processor and memory management, such as context personal or classroom use is granted without fee provided that copies are switching; second, it dispatches a single task to the CPU, not made or distributed for profit or commercial advantage and that copies which may be either an application software task or a special bear this notice and the full citation on the first page. To copy otherwise, to idle task; third, it specifies pairs of the form (i, a) indicating republish, to post on servers or to redistribute to lists, requires prior specific that the future processor event i will cause an interrupt that permission and/or a fee. VEE’05, June 11-12, 2005, Chicago, Illinois, USA. wakes up the S machine with its program counter set to the Copyright 2005 ACM 1-59593-047-7/05/0006...$5.00. S code address a. 35 The E and S architecture partitions the microkernel code, without bringing down the system. This permits, in partic- or simply microcode, into two categories: E code supervises ular, adjustments in the event of hardware failures and thus the “logical” execution of application tasks relative to envi- provides a basis for achieving fault-tolerance without com- ronment events; S code supervises the “physical” execution promising the platform-independent reactivity specification of application tasks on the given resources. At any time, —the E code— of a real-time application. E code may release several tasks, but if there is only a sin- The real-time microkernel architecture we introduce here gle CPU, then S code can dispatch at most one released task provides programmable timing and scheduling services. In at a time. In other words, E code specifies the reactivity of this sense, our work relates to other work on microkernels, an embedded system independent of the hardware resources which typically provide basic thread and interprocess com- and the task scheduler, and S code implements a particu- munication services [16, 1, 19, 2]. System services imple- lar scheduler. The scheduler implemented in S code is fully mented on top of a microkernel have already been shown to programmable; it may be static or dynamic, preemptive or perform well, e.g., in [7]. We demonstrate here that high nonpreemptive. Together, the E and S machines form a pro- performance is also possible using an even more flexible, grammable microkernel for the execution of hard real-time programmable microkernel. tasks. The paper is organized as follows. In Section 2, we briefly There are several benefits this architecture offers over tra- review the E machine. In Section 3, we introduce the com- ditional real-time operating systems. plementary S machine, in Section 4, we define the combined Real-time predictability of the application behavior. Since E and S machines, and in Section 5, we present some of the E code specifies the reactivity and timing of the system in- benefits of this way of architecting a real-time kernel. Sec- dependent of the hardware and scheduler, a change in hard- tion 6 describes our implementation of the programmable ware or scheduler does not affect the real-time behavior of microkernel on the StrongARM, and Section 7 evaluates our the application. This is especially important in control ap- overhead measurements for many different scenarios. The fi- plications, where both slow-downs and speed-ups may lead nal Section 8 presents related works. to instabilities. By contrast, in a traditional RTOS, the real- time behavior of an application depends on the scheduling 2. THE EMBEDDED MACHINE scheme, the processor performance, and the system load, This section is a summary of the E Machine presented which makes both code validation and reuse very difficult. in [9]. The E machine is a mediator between physical pro- In our setting, timing predictability depends, of course, on cesses and application software processes: it executes E code, the fact that the S code meets the timing requirements spec- which is system-level machine code that supervises the ex- ified by the E code. Given worst-case execution times of ecution of software processes in relation to physical events. the application code, this can be checked either statically, The E machine has two input and two output interfaces. by scheduling analysis [10], or at run-time. In the latter The physical processes communicate information to the E ma- case, E code run-time exceptions may be used to handle so- chine through environment ports, such as clocks and sensors. called “time-safety” violations (i.e., missed deadlines) in an The application software processes, called tasks, communi- explicit, programmable way [9]. cate information through task ports to the E machine. The Composability of real-time applications. Suppose we want E machine communicates information to the physical pro- to put two software components, each consisting of E, S, cesses and to the tasks by calling system processes, called and application code, on the same hardware. In a traditional drivers, which write to driver ports. The E machine releases RTOS, the combined real-time behavior of both components tasks to an external task scheduler for execution by writing may differ significantly from their individual behaviors if to release ports. Logically, the E machine does not need to run in isolation. Not so in our setting, where the E code of distinguish between environment and task ports; they are both components is always composable, because its execu- both input ports, while driver and release ports are output tion is synchronous [6], that is, E instructions are executed ports of the machine.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 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