Choosing between Xenomai and Linux for real-time apps - Embedded.com

Choosing between Xenomai and Linux for real-time apps

We needed data to help ourselves and our clients in deciding when to use a real-time Linux extension such as Xenoma or when it is sufficient to use mainline Linux with the PREEMPT RT patches applied as well as when unpatched mainline Linux is sufficient.

To gather this data, we set out to compare the performance of three kernels: a baseline Linux kernel; the same kernel with the PREEMPT RT patches; and the same kernel with the Xenomai patches.

Xenomai is a set of patches to Linux that integrates real-time capabilities from the hardware interrupt level on up. The PREEMPT RT patches make sections of the Linux kernel preemptible that are ordinarily blocking.

We measure the timing for performing two tasks. The first task is to toggle a General Purpose IO (GPIO) output at a fixed period. The second task is to respond to a changing input GPIO pin by causing an output GPIO pin’s value to follow it. For this task, rather than polling, we rely on an interrupt to notify us when the GPIO input changes.

For each task, we have four distinct experiments: a Linux user-space process with real-time priority; a Linux kernel module; a Xenomai user-space process; and a Xenomai kernel module. The Linux experiments are run on both a stock Linux kernel and a PREEMPT RT-patched Linux kernel. The Xenomai experiments are run on a Xenomai-patched Linux kernel.

To provide an objective metric, all timing measurements are taken with an external piece of hardware, running a small C program on bare metal.

This paper documents our results. In particular, we begin with a detailed description of the set of tools we developed to test the kernel configurations with details of a a specific hardware test platform, the BeagleBoard C4, an OMAP3 (Arm architecture) system, and the specific kernel configurations we built to test on that platform. We provide extensive numerical results from testing the BeagleBoard.

For instance, the approximate highest external-stimulus frequency for which at least 95% of the time the latency does not exceed 1/2 the period is 31kHz. This frequency is achieved with a kernel module on stock Linux; the best that can be achieved with a userspace module is 8.4kHz, using a Xenomai userspace process. If the latency must not exceed 1/2 the frequency 100% of the time, then Xenomai is the best option for both kernelspace and userspace; a Xenomai kernel module can run at 13.5kHz, while a userspace process can hit 5.9kHz.

In addition to the numerical results, we discuss the qualitative difficulties we experienced in trying to test these configurations on the BeagleBoard. Finally, we offer our recommendations for deciding when to use stock Linux vs. PREEMPT RTpatched Linux vs. Xenomai for real-time applications.

To read this external content in full, download the paper from the author archives at OASDL. https://www.osadl.org/fileadmin/dam/rtlws/12/Brown.pdf

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.