RTOS as State Machine: Synthesis of Optimized Zephyr Embedded Systems
- Typ der Arbeit: Bachelorarbeit
- Status der Arbeit: reserviert
- Projekte: AHA
- Betreuer: Andreas Kässens, Daniel Lohmann

[Generated with AI]
Context
Within the AHA project, we focus on optimizing embedded systems by specialization of the OS itself. Using the Automatic Real-time Analyzer (ARA), we perform static analysis to find interactions between different tasks, resulting in a State Transition Graph (STG)1. This information can be used to calculate effects of the system calls and tailor the implementation to the specific needs of the application. With the execution of Zephyr system calls on IR level during analysis, we are able to extract information about the OS objects before and after a system call. This allows specializing the RTOS interface to a state-machine, where system calls are transitions between global OS states.
Problem
We want to see the potential of automatic system call tailoring per application, but the specialization of system calls is missing completely. We need to generate a specialized system call implementation per invocation that can be compiled into the Zephyr binary. Secondly, the correct specialized function must be called by the application.
Goal
In this bachelor's thesis, the student shall create manually minimized system call functions for a group of applications/benchmarks, e.g. containing precalculated scheduler data structure modifications.
For example, if the application calls k_sem_take(sem_a, K_FOREVER) the generic RTOS implementation will modify at least the state on sem_a, and possibly the scheduler ready-queue.
These effects can be detected statically and transformed into a very simple function, for example k_sem_take_bb42(), that must have exactly the same effect.
Additionally, locking patterns inside the kernel may need to be imitated to match the behavior of the generic implementation.
Depending on the specific application, these optimized system calls shall be integrated into the Zephyr compilation process, e.g. using conditional compilation and Zephyr snippets2.
This requires analysis and extension of the Zephyr build system and helper scripts3.
Also, the application's call-site must be adapted to invoke this optimized function, for example using a compiler plugin that rewrites the application code. To evaluate the results, the student should compare the kernel overhead of the manually optimized system calls with an unmodified Zephyr build on benchmark applications, e.g. the Thread Metric benchmark suite. For development, qemu can be used, the measurements can be executed on an ESP32-C3 or Raspberry Pi Pico 2. Finally, the increased code size can be analyzed.
Topics: Zephyr, LLVM, Python, C, Static Analysis, Optimization
References
-
OSPERT
Workshop
B
IRx: RTOS-Aware Abstract Interpretation using an LLVM-based Interpreter -
Proceedings of the 19th Annual Workshop on Operating Systems Platforms for Embedded Real-Time Applications (OSPERT '25)2025.
PDF [BibTex]
-
RTAS
Conference
A
ARA: Static Initialization of Dynamically-Created System Objects -
Proceedings of the 27th IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS'21)2021.
PDF Details Video Teaser Video 10.1109/RTAS52030.2021.00039 [BibTex]
-
OSPERT
Workshop
B
Back to the Roots: Implementing the RTOS as a Specialized State Machine -
Proceedings of the 11th Annual Workshop on Operating Systems Platforms for Embedded Real-Time Applications (OSPERT '15)2015.
PDF [BibTex]
Controlling the Kite: Static Control-Flow System Analysis for Embedded Controllers with Zephyr RTOS in ARA
- Typ
- Masterarbeit
- Status
- abgeschlossen
- Supervisors
- Andreas Kässens
Gerion Entrup
Daniel Lohmann - Project
- AHA
- Bearbeiter
- Vitali Fendel (abgegeben: 03. Dec 2024)
RTOS of the Day: Performance Comparison and Analysis of Open Source Real-Time Operating Systems
- Typ
- Bachelorarbeit
- Status
- abgeschlossen
- Supervisors
- Andreas Kässens
Daniel Lohmann - Project
- AHA
- Bearbeiter
- Jan Heinemeyer (abgegeben: 14. Feb 2025)
