Linux – What are the differences between the “generic” and “server” kernel images provided by Ubuntu

kernellinuxUbuntu

In particular, I'm wondering if there are any patches or config adjustments made to the disk cache size in the server edition. I'm running on a small system (256M RAM), and would like to experiment with keeping the disk cache size smaller so that there's more memory available for applications.

I've found this page at Ubuntu's website, which neither answers my questions nor is about the 9.04 release.

Best Answer

I'm guessing the difference is mostly in the fact that the server kernel is not preemptive, like the desktop kernel is. This is a bit complicated:

Preempting means kicking process A from the CPU in favor of process B, in simple terms. End-users expect a responsive system. Therefore, a desktop will run a preemptive kernel, which can favor user interaction above running programs. This means that the kernel can 'kick' a background program, favoring a user program by granting it runtime on the CPU, even before the background program's timeslice is over and before the background program yields the CPU.

A server on the other hand, is built to run a couple of programs in the background (like Apache) and not to interact with a user. Therefore, a server will run a non preemptive kernel, and so be optimized for running programs in the background.

You can read a bit about Ubuntu kernel configuration here. The article is a couple of years old, but I'm pretty sure the preemption bit is still one of the biggest differences between Ubuntu's desktop and server kernels. Another difference is the choice of I/O scheduler: the server uses the deadlines scheduler, the desktop the CFQ. Admittedly, I took that from the linked article.

As for disk cache, Linux caches. Period. Linux will happily use all of your RAM as disk cache. It doesn't matter if you have 512MB of RAM or 1GB of RAM: Linux will use it if it sees fit to. There is not tweaking of this that I am aware of.

Also know that there is no downside to this: as your programs require more RAM, less RAM will be used for cache. The fact that your VM has 256MB only and that some of that is used as cache, will not hamper performance of your programs: if the programs request RAM, they will get it instantly, at the cost of having less cache. That is a Good Thing TM. Again: memory used as cache is still available to your applications. It will be reclaimed instantly and giving to a memory hungry application if the kernel thinks that appropriate. Running a different kernel will not change this.