The following technical report is available from
http://aib.informatik.rwth-aachen.de:

A Real-time Capable, Open-Source-based Platform for Off-the-Shelf Embedded Devices
Igor Kalkov
AIB 2018-03

Nowadays, software plays a crucial role in the development of embedded products. The product's design and development process can be significantly simplified by relying on reusable software components and modern general-purpose hardware. However, such off-the-shelf components are typically not able to provide real-time support required in the industry. To address this limitation, different approaches were presented in the past to enable the use of high-level software while retaining precise timings during the interaction with the physical environment. For example, real-time capable Linux running on general-purpose hardware is widely used in industrial automation today. Furthermore, Linux-based platforms like Android are continuously gaining popularity in all sectors of the market. Due to its intuitive user interface and a wide range of supported hardware, Android is already broadly deployed in different industrial use cases. However, Android devices used in embedded products are still restricted to serving the purpose of pure data visualization and handling of the user input. To extend Android's field of application to time-critical domains, this work presents a holistic approach for combining the performance of modern general-purpose off-the-shelf hardware with predictability and determinism of a real-time capable operating system. Instead of adopting common methods for limiting the real-time support to the Linux kernel and native applications, it provides a global perspective on Android's architecture including the Linux kernel, main high-level components and their interaction in time-critical scenarios.

The first part of this dissertation covers enhancements for minimizing the process scheduling latency using the PREEMPT_RT patch. Since Android is built upon Linux, introducing a fully preemptible kernel and a high-resolution timer enables a more precise process management. This approach allows Android to achieve bounded scheduling deviations in the same order of magnitude as industrial Linux-based systems. In the second part, it is shown that Android's original memory management may cause unpredictable suspensions of running applications or even automatically terminate long-term background processes. To address this issue, the platform is extended with a real-time capable garbage collector based on reference counting. The new collector operates concurrently to real-time threads in a non-blocking incremental manner, avoiding undesired interferences. Furthermore, the proposed modifications provide additional protection for persistent background services. Finally, this thesis implements enhanced methods for data exchange between separate Android applications. Being seamlessly integrated into the platform, new mechanisms allow predictable communication and bounded delays for delivering arbitrary messages across process boundaries.

A detailed evaluation of the introduced platform changes highlights the effectiveness and scalability of the presented approach. The resulting system performs better in terms of responsiveness and determinism, while staying fully compatible with standard Android components and third-party applications. By combining powerful general-purpose hardware and high-level programming paradigms, Android applications are now able to additionally fulfill strict timing requirements. This allows utilizing the advantages of Android in industrial use cases, which facilitates the development of easily extendable and less complex embedded products with intuitive user interfaces.