Linux Kernel Internals, Second Edition
Authors: Michael Beck, Harold Bohme, Mirko Dziadzka, Ulrich Kunitz, Robert Magnus, Dirk Verworner
Price: $45 US
Reviewer: Karl Majer
Linux Kernel Internals is an exceptionally well-written book on the internal workings of the 2.0 kernel. It covers each aspect of the kernel in great depth and at a very high level of detail.
The book starts with an introduction to Linux and then ushers the reader along to the methodology of building a kernel. The reader is then introduced to the primitives of the kernel itself, its data structures, algorithms and system calls. At this point the user should have a reasonable understanding of the basics of the kernel.
The author's discussion then migrates to memory management within the Linux kernel. An introduction on architecture-independent memory management begins this section. Other covered points of interest concerning Linux memory management are the assignment of virtual address space for the proc file system, the methodology chosen by the kernel to do caching of block devices, and the manner in which the Linux kernel pages.
Interprocess communication is the next topic. The reader learns the methods by which the kernel synchronizes communication among its various parts. A brief discussion is held concerning communications via files, sockets and pipes.
Next, the Linux file system is introduced. The basics of a file system are described, as well as how the kernel sees the file system. Following that is the Linux implementation of the proc file system, and finally an excursion into the workings of the EXT2 file system.
An operating system wouldn't be complete without device drivers to allow the end user to attach and use any additional devices he may have. The book covers character devices and polling devices in-depth, and then moves on to explain the difference between writing polling device drivers versus interrupt-driven device drivers. The user is then led through a tutorial on implementing a device driver to manipulate the PC speaker.
One of the true delights of the Linux operating system is its inherent and native network support. Unlike other non-UNIX operating systems, Linux is quite capable of using network services without the installation of special software. The Linux kernel handles communication at a very low level, and the book discusses this and the kernel's handling of network devices with a great deal of depth. The various communication protocols, i.e., IP, TCP, UDP, ARP, and the manner in which they are implemented are also discussed.
In order for the Linux kernel to support a device, protocol or even another processor, the kernel must “know” of these things by including the source code required to support the items internally. While this is not a particularly difficult thing to do, it does however increase the size of the kernel which runs in memory. A method by which the kernel can load only the necessary objects needed for operation, otherwise known as modules, was developed.
An introduction to the modules in the kernel can be obtained from the excellent section on modules in this book. The discourse covers items such as the types of kernel objects which can be made into modules, and the kernel daemon, the program which runs in memory and handles the dynamic usage of modules. Finally, there is an elegant tutorial on the actual writing and debugging of a module.
Given the availability and low cost of components today, people naturally desire multiple processors in their computers. Although disappointingly brief, a section on SMP (Symmetrical Multi-Processing) is included in the book. While this section does contain a good deal of information, it is comparatively sparse and Intel-centric.
At the conclusion of the primary discussion, the book offers four appendices which contain a wealth of information. Each system call available to the Linux programmer is discussed in detail, as are all of the commands related to obtaining kernel information. An in-depth look at the proc file system and information about the running kernel which it can provide is examined. Finally, the reader is given a fairly good look at the boot processes and all that is involved in starting the Linux system.
All in all, Linux Kernel Internals is a very good book for high level, in-depth reading about the kernel. The only drawback would be its Intel-based twist, which while acceptable, is not exemplary of the strongest feature of Linux—its ability to run on many hardware platforms both old and modern such as DEC Alpha, Sun SPARCs, Macintosh and SGI.
Karl Majer is currently a UNIX system administrator for America Online. In his little spare time, he enjoys spending time with his family, programming, reading and promoting Linux. Feel free to send e-mail to him at email@example.com.