Monday, December 14, 2009

Linux Monday: Kernel Check

Linux Monday: Fine-Tune The Kernel

One of the advantages we Linux geeks like to claim over competing operating systems is the flexibility of the system. We're not talking about changing your screen saver--we're talking the guts of the operating system itself.

The most basic, core level part of an operating system is called the kernel. The term "kernel" is generally used to refer to the Linux kernel, but more accurately every OS has a kernel. This piece is slightly dated but has a still sound description of kernels:

The kernel is the first part of the operating system to load into memory during booting (i.e., system startup), and it remains there for the entire duration of the computer session because its services are required continuously. Thus it is important for it to be as small as possible while still providing all the essential services needed by the other parts of the operating system and by the various application programs.

As small as possible. That's where you come in.

Every operating system kernel contains a lot of extras that a just a tiny share of the market needs. Sometimes it's code for backward compatibility, other times it's highly specialized (for example, ham radio software), or things that only programmers need.

Problem is, we have no idea what's embedded in the Windows or Mac kernel, because it's proprietary and locked in place. Thus your Windows system is doing work that you don't need and can't stop. But the open-source Linux kernel can be fine-tuned to your system's specs and for your style of use.

This used to be at the high end of geeky. But KernelCheck is a relatively painless way to optimize your kernel.

I first mentioned, and used, this little gem a few months back. I've managed to speed up my personal benchmark, detecting aliens, about 60% with a somewhat optimized kernel.

But unfortunately, not too long after I discovered it, the site that maintains the downloadable kernel code moved some file directories and KernelCheck stopped working. Some geeks put together patches, and after a couple tries I figured out how to use those (after some command line voodoo). But now other geeks have put together a downloadable file with those patches already installed. Installing in Ubuntu or another Debian-based system is easy: download and click.

First, make sure you have an old kernel backed up in case something goes wrong. (Ubuntu already did this for me). You can make sure this is available be rebooting and looking at your GRUB menu (that's GRand Unified Bootloader). If you dual-boot with Windows and Linux, you'll be familiar with this. If not, hitting Escape on bootup usually works.

KernelCheck showed up on my Ubuntu menu under System Tools. Start it up and you'll be prompted for your password. Follow the series of fairly intuitive prompts. Eventually you'll get to a big tree diagram with a lot of checkmark. The first time you may just want to leave all these at their defaults and close the checkmark screen.

That'll start the build of your new kernel. The screen will tell you this takes two to four hours. The higher-end the machine, the faster this will go. Once you're done, reboot and make sure everything's in one piece.

If that was fun, you can try it again and uncheck some stuff to make a smaller, faster kernel. You need to be careful the first time you try this not to take too much stuff out. I had to go back and re-do one when I accidentally disabled my external hard drive. This piece has some good suggestions of what's safe.