Linux PREEMPT-RT v2.6.33 versus v3.6.6: Better or worse for real-time applications? Hasan Fayyad-Kazan Electronics and Informatics Department Vrije Universiteit Brussel Pleinlaan 2, 1050 Brussels-Belgium hafayyad@vub.ac.be Luc Perneel Electronics and Informatics Department Vrije Universiteit Brussel Pleinlaan 2, 1050 Brussels-Belgium luc.perneel@vub.ac.be Martin Timmerman Electronics and Informatics Department Vrije Universiteit Brussel Pleinlaan 2, 1050 Brussels-Belgium martin.timmerman@vub.ac.be ABSTRACT Linux was originally designed as a general purpose operating system without consideration for real-time applications. Recently, it became a more reliable candidate in the real-time field due to its daily improvements, both for general purpose and real-time usages. In this research, we test two Linux PREEMPT-RT versions (v3.6.6 and v2.6.33.7) in the aim of benchmarking its performance and behaviour to give an insight whether the enhancements in its kernel are improving the determinism of the operating system. Our benchmark will be based on the following experimental measurements’ metrics: thread switch latency, interrupt latency, sustained interrupt frequency, mutex and semaphore acquisition and release durations, and finally the locking behaviour of mutex. These measurements are executed for each Linux version, on the same x86 platform (ATOM processor) using the same test framework and measurement equipment. Comparing the results show that Linux v3.6.6 has significantly better worst case results which makes the actual Linux PREEMPT-RT version a better candidate for RT-applications. Suggestions are made for further improvements. Keywords Real-time, Linux, PREEMPT-RT 1. INTRODUCTION Because of its free open source advantage, stability and supporting multi-processor architecture, Linux operating system (OS) stands high in many (embedded) commercial product developers’ favour and becomes one of the fastest-growing (embedded) operation systems [1]. Also, with the development of open-source projects, embedded Linux provides many opportunities for developing customized operation system. Moreover, its reliability and robustness made it widely used even in safety and mission critical systems. In these contexts, time is extremely important; the system in which its correctness depends not only on the logical results of computations, but also on the time at which the results are produced is called real-time system [2]. Although Linux is a popular and widely used OS, the standard Linux kernel fails to provide the timing guarantees required by critical real-time systems [3]. To circumvent this problem, academic research and industrial efforts have created several real- time Linux implementations [4]. The most adopted solutions are RTLinux/RTCore [5], RTAI [6], Xenomai [7] and the PREEMPT-RT [8] patch. Each one of these real-time enhanced kernels has its internal architecture, its strength and weaknesses [9]. All these approaches operate around the periphery of the kernel, except PREEMPT-RT patch which is mainlined in the current kernel and used by great actors such as WindRiver in their Linux4 [10] solution. In this research, we evaluate two different versions of Linux PREEMPT-RT, an old version (2.6.33.7) and a newer version (3.6.6). The reason for choosing these kernel versions is that since Linux version 2.6 it started to be possible to get soft real-time performance through a simple kernel configuration to make the kernel fully preemptable, while Linux 3.6 is chosen as it is the latest version at the time of doing the tests. The aim of this evaluation is to have benchmark information that can show whether Linux real-time enhancements and changes since version 2.6 are making it a more reliable real-time operating system or not. For this evaluation, a testing suite of five performance tests and one behaviour test are used. The performance tests are: thread switch latency, interrupt latency, sustained interrupt frequency, and semaphore and mutex acquire-release timing in contention case, while the behaviour test checks the mutex locking behaviour. 2. LINUX PREEMPT-RT Linux PREEMPT-RT (LinuxPrt) [11, 12] is a Linux real- time patch maintained by Ingo Molnar and Thomas Gleixner [15]. This patch is the most successful Linux modification that transforms the Linux into a fully preemptible kernel without the help of microkernel (the architecture implemented in RTAI or RTLinux) [13]. It allows almost the whole kernel to be preempted, except for a few very small regions of code (“raw_spinlock critical regions”). This is done by replacing most kernel spinlocks with mutexes that support priority inheritance and are preemptive, as well as moving all interrupts to kernel threads [9, 14]. Also, this patch presents new operating system enrichments to reduce both maximum and average response time of the Linux kernel [9]. These enhancements were progressively added to the Linux kernel to offer real-time capabilities. The most important enhancements are: High resolution timers ( a patch set, which is independently maintained by Thomas Gliexner [15], which allows precise timed scheduling and removes the dependency of timers EWiLi’13, August 2627, 2013, Toulouse, FRANCE Copyright retained by the authors