Realtime Linux
- Check How to turn Hardware into Football from the techunited page.
- Check the E-box page for more information.
- Check Installing a Real-Time Linux Kernel for Dummies by Jeroen de Best & Roel Merry
- IMPORTANT: When using Ubuntu 10.04 and the linux-rt kernel, in addition to what is mentioned in the above about CPU-scaling, remove the file "/etc/init.d/ondemand" to stop the scaling mode from changing to ondemand 1 minute after startup.
Ubuntu RealTime Kernels
Source: Ubuntu Documentation
Check the source for an up to date version of this subject, the text provided here is for quick reference and was copied from the source when it was last edited on 23-08-2011.
Prerequisite definitions:
kernel - central component of a computer's operating system, bridging between applications and the actual data processing done at the hardware level. See also Wikipedia's Kernel entry.
real-time - an attempt to have deterministic operational deadlines from an event to system response, i.e. the time it takes the computer to respond to an event is known and predictable. A byproduct of this is usually lower latency for audio. See also Wikipedia's Real-time entry.
vanilla kernel source - Linux kernel source code than you can download at www.kernel.org.
Ubuntu kernel source - Linux kernel source code used in Ubuntu and modified for offer all Ubuntu features. You can download it at http://kernel.ubuntu.com/git or simply install binary releases via Synaptic.
Kernel Types
-generic kernel - this is the stock kernel that is provided by default in Ubuntu.
-preempt kernel - this kernel is based on the -generic kernel source tree but is built with different configurations (settings) to reduce latency. Also known as a soft real-time kernel.
-rt kernel - is based on the Ubuntu kernel source tree with Ingo Molnar maintained PREEMPT_RT patch applied to it. Also know as a hard real-time kernel.
-lowlatency kernel - very similar to the -preempt kernel and based on the -generic kernel source tree, but uses a more aggressive configuration to further reduce latency. Also know as a soft real-time kernel.
-realtime kernel - is based on the vanilla kernel source tree with Ingo Molnar maintained PREEMPT_RT patch applied to it. Also know as a hard real-time kernel.
At the moment only the first three kernels are available through official Ubuntu archives.
Choosing a Kernel for Your Use Case
These are some simple guidelines provided to help you understand which kernel, and in which order, you should test to fit your use case.
- If you do not require low latency for your system then please use the -generic kernel.
- If you need a low latency system (e.g. for recording audio) then please use the -preempt kernel as a first choice. This reduces latency but doesn't sacrifice power saving features. It is available only for 64 bit systems (also called amd64).
- If the -preempt kernel does not provide enough low latency for your needs (or you have an 32 bit system) then you should try the -lowlatency kernel.
- If the -lowlatency kernel isn't enough then you should try the -rt kernel.
- If the -rt kernel isn't enough stable for you then you should try the -realtime kernel.
Kernel Repositories
Currently, not all kernels are available in the official Ubuntu repositories. The balance may be found in select PPA's.
First attempt to locate the desired kernel in the official Ubuntu repositories by using your choice of package management (i.e. Synaptic or apt-get). Warning - the -rt kernel release can lag behind mainstream, check to the kernel version number! As of this writing, Lucid release, the kernel is 2.6.32 but the -rt kernel available in the Ubuntu repositories is 2.6.31.
Next it is recommended you search in the following selective and discriminating PPAs:
- Alessio Igor Bogani's PPA - https://launchpad.net/~abogani/+archive/ppa
- Ubuntu Studio Developer's PPA - https://launchpad.net/~ubuntustudio-dev/+archive/ppa
It is not recommended to use kernels from unknown or untested PPA's! You do not know what configuration were used or how it was built and an unstable (or unbootable) system could be the result. Use only trusted PPA's
Please note that Alessio Igor Bogani has been the Ubuntu Studio kernel maintainer for several releases and has the support of the Ubuntu Studio team.
Kernel Confusion
Some confusion persists about the purposes of -lowlatency and -realtime kernels.
The goal of -realtime and -rt (hard real-time) kernels is to achieve the lowest possible latency at every cost. In technical slang hard realtime systems should always meet their deadlines. Thus developers should use the most advanced programming techniques (sleeping spinlocks, PI Mutex, Full preemption, IRQ Threads and others) and sacrifice things like reliability, power-saving and throughput. Almost all parts of kernel should be analysed to guarantee that right behaviour always occurs.
The goal of -preempt and -lowlatency (soft real-time) kernels is to achieve good realtime characteristics, meanwhile offering welcomed features like rock-solid reliability, good power-saving features and also good throughput. But in this way it can't guarantee lowest latency under all conditions.
FAQ: from Ubuntu Wiki
Q: What is the difference between an -rt kernel and a -realtime kernel?
A: From a technical point of view, -rt and -realtime are the same kernel. They are both based on the PREEMPT_RT patchset, although the version may be different. The main difference is that the -rt kernel should be based on the Ubuntu source tree (and therefore can use the same features, patches, enabled hardware, security fixes and so on) and should offer the same services that the Ubuntu default -generic kernel offers. For example, it should be compatible with closed video drivers (nvidia and fglrx), any external DKMS drivers, and have available backport packages. The goal of an -rt kernel is to obtain a real time variant of the Ubuntu kernel that is aligned with the -generic kernel.
On the other hand, the -realtime kernel is a PREEMPT_RT patched kernel based on the vanilla source tree (not the Ubuntu source). This kernel will be missing Ubuntu specific code, patches or security fixes and it isn't guaranteed to be compatible with any external software (low level utilities, DKMS drivers and so on). It does not use the same Linux kernel version as the -generic kernel, and so these two kernels are not aligned. It is a working, upstream real-time kernel that is being used on Ubuntu. No more no less.