Sloth: The Virtue and Vice of Latency Hiding in Hardware-Centric Operating Systems

Language
en
Document Type
Doctoral Thesis
Issue Date
2014-07-14
Issue Year
2014
Authors
Hofer, Wanja
Editor
Abstract

Software for embedded systems needs to be tailored to the application requirements to provide for the lowest cost overhead possible; this is especially important for embedded operating systems, which do not provide a business value of their own. State-of-the-art embedded operating systems are tailored to the requirements of the application above, but they abstract from the hardware platform below, missing out on advantageous hardware peculiarities to optimize the non-functional properties of the system. Additionally, they provide the application programmer with a multitude of control flow types, which leads to several severe restrictions and problems for the application development and in the real-time execution of the system---for instance, high-priority tasks can be interrupted by low-priority interrupt service routines at any time.

The Sloth operating system design for event-triggered and time-triggered embedded real-time systems as presented in this thesis is unique in that it employs a hardware-centric approach for its scheduling, dispatching, and timing services and makes use of hardware particularities---with the purpose of optimizing the non-functional properties of the operating system and the application. In its implementation, Sloth assigns each task an interrupt source with an appropriately configured priority and maps software activations of that task to setting the request bit of the interrupt source. This way, Sloth has the hardware interrupt subsystem make the scheduling decision with the corresponding dispatch of the interrupt handler, which directly executes the application task function. Time-triggered dispatch tables are encapsulated in hardware timer cell arrays that Sloth pre-configures at initialization time with the corresponding timing parameters, making the hardware timer subsystem execute the dispatcher rounds autonomously at run time.

The evaluation of the Sloth operating system implementation shows that its light-weight design mitigates or even eliminates the safety-related problems and restrictions in the real-time execution of the application by providing a unified control flow abstraction in a unified priority space, eliminating the artificial distinction between tasks and ISRs. Additionally, its exhibited non-functional properties show unprecedented levels of efficiency by hiding latencies in the hardware subsystems: A feature-complete Sloth operating system can be tailored to less than 200 lines of source code; it compiles to less than 500 bytes of code memory and as few as 8 bytes of data memory; and it can schedule and dispatch tasks in as few as 12 clock cycles with speed-up factors of up to 106 compared to commercial operating systems. Since Sloth prototypically implements the automotive OSEK OS, OSEKtime OS, and AUTOSAR OS standards and runs on commodity off-the-shelf hardware, it is applicable to a wide range of embedded real-time systems.

Abstract

Software für eingebettete Systeme wird an die Anwendungsanforderungen angepasst, um die Kosten so niedrig wie möglich zu halten; dies betrifft insbesondere eingebettete Betriebssysteme, welche nicht zum Wert des Endprodukts beitragen. Aktuelle eingebettete Betriebssysteme passen sich an die darüberliegende Anwendung an, aber abstrahieren von der darunterliegenden Hardwareplattform, was vorteilhafte Hardwarebesonderheiten zur Optimierung nichtfunktionaler Eigenschaften des Systems ungenutzt lässt. Außerdem bieten sie dem Anwendungsprogrammierer eine Vielzahl an Kontrollflusstypen an, was zu diversen schweren Einschränkungen und Problemen bei der Anwendungsentwicklung und in der Echtzeitausführung des Systems führt -- zum Beispiel, dass hochpriore Tasks jederzeit durch niedrigpriore Interrupt-Handler unterbrochen werden können.

Der Entwurf des Sloth-Betriebssystems für ereignisgesteuerte und zeitgesteuerte eingebettete Echtzeitsysteme, welcher in dieser Arbeit vorgestellt wird, ist von besonderer Art, da er einen hardwarezentrischen Ansatz für die Einplanungs-, Einlastungs- und für zeitbasierte Dienste einsetzt und spezifische Hardwareeigenschaften ausnutzt -- mit dem Ziel, die nichtfunktionalen Eigenschaften des Betriebssystems und der Anwendung zu optimieren. In seiner Implementierung weist Sloth jedem Task eine Interruptquelle mit einer entsprechend konfigurierten Priorität zu und bildet Softwareaktivierungen dieses Tasks auf das Setzen des Request-Bits der Interruptquelle ab. Auf diese Weise lässt Sloth das Hardware-Interrupt-Subsystem die Einplanungsentscheidung treffen und den entsprechenden Interrupt-Handler einlasten, welcher direkt die Taskfunktion der Anwendung ausführt. Zeitgesteuerte Einlastungstabellen werden in Arrays von Hardware-Timer-Zellen eingebettet, welche von Sloth bei der Initialisierung mit den entsprechenden Zeitparametern vorkonfiguriert werden, um das Hardware-Timer-Subsystem die Einlastungsrunden zur Laufzeit autonom ausführen zu lassen.

Die Evaluation der Implementierung des Sloth-Betriebssystems zeigt, dass der leichtgewichtige Entwurf die sicherheitsrelevanten Probleme und Einschränkungen bei der Echtzeitausführung der Anwendung reduziert oder sogar eliminiert, indem er eine einheitliche Kontrollflussabstraktion in einem vereinigten Prioritätenraum anbietet, was die künstliche Unterscheidung zwischen Tasks und Interrupt-Handlern beseitigt. Außerdem weisen die nichtfunktionalen Eigenschaften ein neues Niveau an Effizienz auf, indem Sloth Latenzen in Hardware-Subsystemen versteckt: Ein vollständiges Sloth-Betriebssystem kann auf weniger als 200 Zeilen Code angepasst werden, auf weniger als 500 Bytes im Codespeicher und 8 Bytes im Datenspeicher kompiliert werden, und er kann Tasks innerhalb von 12 Taktzyklen einplanen und einlasten -- mit Speed-Up-Faktoren von bis zu 106 im Vergleich zu kommerziellen Betriebssystemen. Da Sloth prototypisch die Standards OSEK OS, OSEKtime OS und AUTOSAR OS implementiert, welche von der Automobilindustrie entwickelt wurden, und da das Betriebssystem auf Standard-Hardware läuft, ist der Ansatz anwendbar auf eine breite Menge an eingebetteten Echtzeitsystemen.

DOI
Faculties & Collections
Zugehörige ORCIDs