**This is an old revision of the document!**

Low Latency Kernel

A computer's CPU does a lot, cycling constantly through series of loops and commands and probes and checks and refreshes and updates so consistently that sys admin even today talk in terms of “CPU cycles” when estimating the “cost” of a computationally intensive project. Regardless of what you do artistically on your computer, yours is no exception: the CPU is in high demand every second, and not everything demanding its attention can be tended to at the same time. For this reason, the driver of the CPU (the “kernel”) queues all tasks needing attention, delegates priorities to each one, and then executes chunks of each waiting task according to priority. This happens millions times per second.

For most everyday computing, the Linux kernel's somewhat conservative policy of what is important and what can wait another millisecond or two before getting worked on is perfect; onscreen effects get displayed smoothly, music plays seamlessly, the desktop clock keeps ticking, and no one is ever aware that user tasks are secretly being preempted for boring low-level computer tasks.

One place that this does not do well is professional audio, or more specifically, professional audio with realtime effects or realtime recording. Most other artistic tasks (even video effects) are perfectly acceptable on default settings, but pro audio requires high priority in order to playback smoothly without clicks, stutters, or breaks (called “xruns”). Technically speaking, this means that audio must gain the permission to preempt the usual priorities of running tasks as needed. Normally, this is not allowed on a Linux system, but as of kernel version 2.6.38.4 (so any 3.x or higher kernel) the ability to whitelist preemption was written into the OS.

As long as you are running a Linux kernel versioned 3 or higher, you have a preemptive kernel already and there is no need to look for a special “low latency” kernel. You are, however, required to whitelist the applications that you want to allow to preempt the kernel's better judgement.

Whitelisting

su -c '/sbin/setcap cap_ipc_lock,cap_sys_nice=ep /usr/bin/jackd'