A few years ago, a magical “200-line patch” was added to the Linux kernel. It aimed to increase the responsiveness of programs running at the same time on your Linux system. While it was effective, developer Daniel Poelzleithner thinks he can do better.
To achieve ultimate responsiveness on your Linux system, you may want to take a look at Ulatencyd.
Warning: In order to try out Ulatencyd, you’ll need to get your hands deep into the terminal, compiling the program from scratch. In other words, this isn’t the best choice for beginners. If you want, you can brush up on some terminal commands beforehand.
Ulatencyd is a system daemon for Linux that gives the kernel some hints and limitations on how to deal with processes. It does this using something called cgroups, which are essentially different priority levels. Processes that have graphical user interfaces and need to be responsive – such as desktop environments – will receive a higher priority than processes that don’t need quite that much attention, and won’t cause serious issues should they stutter.
Poelzleithner also addresses how his approach is better than the 200-line patch:
I think that this minimal approach [referring to the 200-line patch] is good for some circumstances, but does not provide enough flexibility required for a true low latency desktop. Perfect desktop scheduling needs a lot of heuristics, that don’t belong in the kernel. For example, the patch won’t protect you from swap of death, fork bombs, can’t detect which process you are actually using and give more cpu shares to them, can’t give realtime priorities to processes like jackd, etc… ulatencyd is designed for fixing exactly that.
To install Ulatencyd on Ubuntu, run the following command:
sudo apt-get install libglib2.0-dev libdbus-glib-1-dev liblua5.1-0-dev lua-posix-dev procps doxygen libmoose-perl pandoc python-dbus python-qt4 python-qt4-dbus xcb xcb-proto libxau-dev libprocps3-dev cmake
This command will install the needed dependencies of the software. Package names differ between distros, so users of distros other than Ubuntu will need to look at the project’s page and see which packages need to be installed based on the provided list.
Save this to wherever you’d like (such as your Downloads folder), and then extract the zip.
Then, for all distros, use cd to go to the extracted folder (such as
cd ./Downloads/ulatency-master), and run this command:
cmake . && make DEBUG=1 && make docs && sudo make install
This will compile the code and documentation and then install it.
Finally, run this command to start ulatencyd:
sudo /usr/local/sbin/ulatencyd -v -f /var/log/ulatencyd
You can also choose to restart your system if you’d like.
Please be aware that some people have reported that installing Ulatencyd has caused kernel panics. The general consensus seems to be that those kernel panics are the result of bugs in the kernel rather than issues with Ulatencyd. However, when using the latest code of Ulatencyd from its Git repo, and the latest daily image of Ubuntu 14.04, I have no issues whatsoever.
I find that Ulatencyd does make a difference, although the experience may be different for you. If you’re already using a fast computer, the potential to see a difference is low because you already have enough resources to give every process the attention that it wants. For slower computers, the potential to see a difference is greater, but it’s dependent on your workload.
Responsiveness is a fairly subjective statistic, but the closest metric that can represent it is the average load. Google+ user Rafal Cieslak tried Ulatencyd in combination with another daemon called verynice, and saw the average load dropped from 2.2 – 2.8 to 0.8 – 1.5. I haven’t quite seen that much of an improvement using ulatencyd alone, but idle loads of ~0.5 drop down to ~0.2, and busy loads of ~2.4 drop down to ~1.8-2.0. In any case, it’s an improvement that’s measurable.
For those who care, developer Poelzleithner claims the software is effective:
I’m able to run a make -j 40 on my dual core machine while looking a full hd movie without problems and the ui from kde still feels good.
This is actually pretty impressive for a dual core system, as a “make -j 40” command means that he was compiling a piece of software with fourty threads running at once — something that’s sure to keep the CPU fully utilized.
Remember that this program doesn’t necessarily make your computer faster (as in that it can do more work in less time), but just make it more responsive (as in it pays more attention to the things you interact with and leaves other processes as afterthoughts). However, that doesn’t mean that Ulatencyd isn’t worth trying — a responsive system can be a lot less aggravating for the user.
If you’re still on the hunt for improved speed and responsiveness, don’t forget to check out these four tips on speeding up a Linux system.
Do you have any tricks up your sleeves to improve a Linux system’s performance that you can share with others? Let us know in the comments!