Why choose a low latency kernel over a generic or real-time kernel?

After installing Ubuntu Studio 12.04, I have found that it uses a low latency kernel.

I searched for an explanation and how to change back it to a real-time or generic one. However, it looks like this part of Linux hasn't been covered to explain the details.

Q: Why choose a low latency kernel over a generic or real-time one?

PS: I have already read the answers from this question and this post.


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

Ubuntu Help Source

So it depends on what you will do with your studio distro. For most users needing fast end-user response time generic will just do fine, for others who need to do professional video editing where even a simple frame drop is unacceptable the real-time kernel is needed.

For a more exhaustive easy-to-understand blog post, read this link


I'm the author of the blogpost linked by ubuntu fan: http://sevencapitalsins.wordpress.com/2007/08/10/low-latency-kernel-wtf/

That blog post doesn't present any fact, it's only theory. It's the way it works, actually: the processor "stops" more frequently to see if there are some processes requiring immediate attention. That means that those processes will be executed before the others, so you won't skip frames when encoding, or have huge delay times between mouse clicks and enemy deaths. It doesn't mean that all processes will end sooner: actually the CPU is losing a bigger portion of its time deciding what process will be executed next, and doing the context switch. So the total execution time is longer, and that's why no one runs a preemptible kernel on webserver or database machines. But a preemptible 300Hz (or even 1000Hz) kernel is the best for gameservers.

But nowadays processors have many cores, so when there are few processes requiring attention they can easily be allocated on a different core rather than waiting for a core to take it.

(stackexchange requires me references/personal experience: I'm an electronic engineer, bloodthirsty noobgamer mantaining several gameservers at http://www.gamezoo.it ).

So, as a rule of thumb, I'd say: if your processor is a powerful number-crunching high-frequency quad-core AND you don't usually open tons of webpages while encoding/decoding/gaming (huh), you could just try the generic (or i686, or amd64 if they exist) kernel and have the highest possible throughput (i.e., the raw number-crunching the processor is able to do). If you experience problems (they should really be minor) or your machine is slightly less powerful than the top of the market, go for the -preempt.

If you're on a low-end machine that has only one or two cores, then try the -lowlatency. You could also try the -realtime, but you'll find that it tends to block processes until the "real-time" ones have finished their job. I believe the realtime kernel isn't the "vanilla" one, but has the CONFIG_PREEMPT_RT patch applied. I think that realtime kernels are only for those who have to build a single application on embedded systems, so usual desktop users shouldn't have real benefits because they usually run a fair number of applications at the same time.

Finally, the most relevant kernel options if you want to recompile your kernel yourself to have a low-latency desktop are:

PREEMPT=y

and:

CONFIG_1000_HZ=y

To add some powersaving you may check this one:

CONFIG_NO_HZ=y