A Kernel of Code
Being from Iowa and all, I understand kernels pretty well. The number of kernels just within a few miles of my home is probably almost uncountable. But those kernels are most useful for feeding cattle and hogs. The kernel we’re going to talk about this week is the heart of the Linux operating system.
You’ve probably heard all about the Linux kernel – that it’s completely configurable open source code. True. That it’s what distinguishes Linux from other OSs. Pretty much true. That you should re-compile it with only the options you need. Again, pretty much true.
Kernel code in any operating system handles the most basic functions of the OS – the interaction between the user and the operating system, the interface between user programs and hardware, and process scheduling to create a multitasking envirnment, among other things. While every operating system has a kernel of this basic code, the Linux kernel is distinguished from the others in several crucial ways:
a. The Linux kernel uses a monolithic architecture as opposed to a microkernel architecture. This means that, despite supporting loadable modules, device drivers are actually part of the kernel code itself. Microkernel architecures, despite their similarity to the loadable driver model, tend to carry more code overhead in order to find, load and unload drivers on demand. This means that the operation of the Linux kernel is markedly faster.
b. The Linux kernel utilizes a system of “demand-paged” executable loading. simply put, this means that Linux only reads into memory the segments of a program that are actually used. Again, the result is efficiency and speed.
c. The Linux kernel also utilizes disk paging. Inactive pages are swapped to disk when the system requires more physical memory. This means that Linux can support larger programs and more simultaneous users.
d. Finally, Linux uses a unified memory pool for both programs and disk cache. All free memory is used for caching, but the cache size is reduced when running larger programs. In other words, resources common to all programs are shared in cache.
These are just the technical advantages of the Linux kernel. The practical advantage is that it is, indeed, open source. Anyone with the knowledge to do so can make changes and correct bugs. Anyone, with even a minimal level of knowledge, can modify this code to suit their system and needs. Whereas most OS kernels are proprietary and, as such, locked away from the user, the Linux kernel is out in the open for everyone to see and improve. As this series progresses through the week, we’ll be looking at how to put this open source philosophy to use in optimizing your own Linux system.