个人工具

UbuntuHelp:UbuntuStudio/RealTimeKernel

来自Ubuntu中文

跳转至: 导航, 搜索

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 fist 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:

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 occur. The goal of -preempt and -lowlatency (soft real-time) kernels it to achieve good realtime characteristics meanwhile offers 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.