Dear Lazyweb: Real-time kernels

I just don’t get them. I really don’t. For years, the perceived wisdom has been that if you want to record audio on Linux, you need a low-latency kernel, real-time kernel. The technical description is a kernel with real-time pre-emption, and the stock kernel that comes with most distros does not have this lovely goodness included. So, you need to grab a vanilla kernel, apply some real-time patches and then you should be up and running. Now, this begs the questions:

  • Why does the kernel that comes with most distros not include the patch?
  • If the real-time patch conflicts with other things (I have been informed it could conflict with RAID), why can’t the support be switched on at boot?
  • If both of the above don’t apply, why can’t I just install kernel-realtime and it installs something that hot-rods my kernel for real-time pre-emption or even an entirely new kernel with the patch?

So, after reading into this a little, I learned that the real-time patch could conflict with other parts of the kernel sub-system, such as the RAID example I gave above. Then, I read this and it seems that the stock kernel is going the real-time way anyway. Oh, the confusion. 😛

While musicians have to even know what a real-time kernel is, it just makes Linux harder and harder to push as a system for producing audio with. We are building Jokosher to make the multi-tracking experience easier, the GStreamer team are making the multimedia framework side easier, now it is the turn of the kernel hackers – please, please solve these problems! :)

  • Juan Carlos I

    I’m with you at last i found someone who realises the problems in multimedia i’m a desktop user and i never understood well why my fabulous linux is not able to play decently a single midi To apply patches is not for me, i just wish you can find an easier way

  • Ben Foote

    Thankyou for finally hitting the nail on the head Jono. Plus, the fact that you’re on PGO will help get the word out on this one. The whole Ubuntu for Studio Musicians project hinges on this single point that the realtime stuff is not in the kernel for whatever reason.

    Now, I’ve had decent success recording with apps without the realtime patches, but after a certain number of tracks, no matter how beefy your computer is, you’ll start to notice the problems.

    Jokosher seems to be spurring the improvements for Gstreamer, so like you said, I really hope it pushes the kernel in the right direction. Apps like ardour and audacity haven’t seemed to make the impact. Here’s hoping!

    And good luck!

  • Tom

    Interesting point.

    Now the pedant hat comes up… you’ve raised a question, not begged one 😛

    More here:

  • Corey

    Bingo! I’ve too read that the official kernel chaps have planned on pre-emption being accepted in the kernel but that was years ago and It still isn’t here yet. I was fine with patching kernels back when I used gentoo, but in a distro like Ubuntu I don’t want to re-patch everytime a security update occurs. A push to get pre-emption in the vanilla kernel is what is needed. Can we get others behind the cause besides us audio folks? What else is pre-emption or real timekernels needed for?

  • Souris

    👿 What the fuck people like Tom do so often invite themselves in threads that don’t concern them.

    Sorry Tom we have NOTHING to do about your considerations about raising or begging anything.

    Like Ben Foote confirms, it seems THERE IS REALLY a problem under Linux with recording audio.

    So, PLEASE, don’t waste this thread …

    I hope we can now the original subject.


  • David Nielsen

    The reason that patch isn’t in the kernel is the exact same reason every other patch isn’t in there, it doesn’t please the developers yet. Parts of the -rt kernel tree have made it into the upstream kernel and other parts will follow when they are good and ready.

    You’ll be pleased to know that Red Hat hired Monty (of fame) to work specifically on getting sound right under Linux without compromising security, having to do ugly hacks and all the standard things you have to worry about when basically running stuff suid. We should see some of his work soonish I think, along with the -rt eventually all being included at least the good bits we should be able to do this right but things take time. The userspace solution isn’t perfect either we still need a low latency sound server with correctly implemented real and pseudotime handling. Polyaudio is actively developed along with some help from Monty and the Jack guys we could make this happen soon.

    But fear not audio folk it’s not that we don’t love you, but we want to love you the right way.. that takes time.

    6 month to a year from now I’d wager all your trials should seeing serious improvement.

    Oh also this whole realtime thing means basically maintaining two kernels since the needs of a server are better forfilled by a non-realtime system e.g. so you see the urgency to do it right rather than right now I hope.

  • http://bleh bleh

    Ubuntu: module-assistant auto-install thekernelmoduleforrealtimestuffyouneedtorunjackinrealtime done. no need to patch the kernel.

  • Reed

    Does Ubuntu (or other distros) offer an alternative Linux kernal image package that has the rt patches in it?

  • Simon Holm Thøgersen

    Have you read the LWN article Kernel Summit 2006: Realtime[1]?

    And to David Nielsen, remember it is Pulseaudio now and not Polyaudio anymore.