This topic was published by DevynCJohnson and viewed 600 times since "". The last page revision was "".
- Topics - 444
A real-time operating system (RTOS) is an operating system capable of processing commands in a consistent amount of time. Real-time operating systems have advanced schedulers, minimal interrupt latency, and minimal thread switching latency. RTOSes are not meant to be faster than non-real-time operating systems. Rather, they are meant to manage interrupts in a timely manner, process data as it arrives, and meet deadlines. The purpose of these concepts is to better function as operating systems for special devices such as medical devices (like artificial cardiac pacemakers), aircraft control, etc. After knowing all this, is it possible to make Linux act like a real-time operating system?
NOTE: RISC (Reduced instruction set computing) is not the same as RTOS.
As many people know, Linux has been used in embedded systems. However, "embedded" is not the same as "real-time", although many real-time systems are embedded, but not all embedded systems are real-time.
The vanilla (original and unmodified) Linux kernel (from kernel.org) does not support real-time abilities. However, there are ways to make Linux act like a real-time operating system. The easiest method is to use a Linux kernel that contains the "PREEMPT_RT patch" (also called the "-rt patch" or "RT patch"). A Linux kernel with the PREEMPT_RT patch supports preemptive multitasking which ensures that each process gets some CPU processing time. Also, the kernel behaves more like a real-time operating system. A Linux kernel with PREEMPT_RT enabled is called a PREEMPT_RT kernel. However, such a kernel is not 100% real-time.
Thankfully, alternatives and additional tools exist. Xenomai is a userland-level development framework that provides an interface between programs and the kernel. Xenomai acts as a second kernel executing beside the Linux kernel. However, installing Xenomai is not enough to achieve real-time processing. Developers must re-compile the program or programs that will be run as real-time applications.
To make Linux operate better as a real-time system, it helps to configure and compile a custom kernel. It is best to disable kernel features that will cause additional latencies and enable features that reduce latencies. For instance, disable "CONFIG_CPU_FREQ" and "CONFIG_CPU_IDLE" so the CPU will not change its clock frequency or change states. The kernel should be configured to control its own power management since the BIOS does so in a way that causes latencies. Also, disable any drivers that are not essential, but make sure that needed drivers are included in the kernel. For instance, on systems lacking SMP, enabling and supporting SMP features will generate unneeded overhead that will cause latencies. Real-time kernels must be designed specifically for the user's hardware and not for a variety of hardware products. For more information on how to configure and compile a custom kernel, check out this Linux kernel guide - http://dcjtech.info/topic/the-linux-kernel/
Adeos (Adaptive Domain Environment for Operating Systems - http://home.gna.org/adeos/) is a nanokernel that runs under the Linux kernel, thus acting as a hypervisor. Adeos runs the Linux system as a real-time operating system. Running Adeos does not require recompiling programs or modifying the Linux kernel.
RTAI (Real-Time Application Interface - https://www.rtai.org/) is a special kernel extension for Linux which offers real-time support. RTAI is POSIX-compliant and open-source. RTAI is a single patch for the Linux kernel that adds various services and a hardware abstraction layer.
When selecting a method or a combination of methods to make Linux a real-time system, check the processor type and ensure that the selected methods support the system's CPU and hardware. Some processors and hardware have special features that enable then to function better in real-time environments. For instance, ARM processors in the Cortex-R series (R-Profile) support real-time execution and processing well.
If unable to achieve 100% real-time features in Linux using any of the above methods (alone or in combination), then there are other open-source alternatives. More can be learned about some of these alternative open-source RTOSes in the links below.