I picked up this book to get up to speed on Linux kernel internals
while porting the kernel to a new architecture. I've ripped through
it and gleaned what I needed to know. Here's a short review for
K5 readers who might find this book interesting.
The authors are university instructors, and the book is based on
their lecture notes from a kernel internals course. As such, it's
as much about operating system kernels in general as it is about
the Linux kernel in particular. Its focus is the Linux 2.2 kernel
for the Intel x86 processor architecture. This focus probably
covers the widest audience, but I sure wish that they'd spent a
couple of pages discussing what's different about Linux on more
modern processor architectures. The text does do a good job explaining the
x86's capabilities and weirdnesses, but not to the point that
they become distracting. Occasionally the academic background
of the material shines through in a comment or two that would
have been better placed as a footnote, but on the whole, the
style is direct and readable.
At the end of each chapter, the authors
summarize the important differences between their presentation
and the workings of the new 2.4 kernel, and do a good job doing
so. Don't worry about this book already being obsolete.
The book covers all of the basic operations of the kernel:
process management, scheduling, interrupt and exception
handling, signals, memory management, the virtual file system,
synchronization, SMP, buffering, System V IPC, and so on.
A fair number of cleaned-up code samples are walked through.
(The unfortunate dependence of the Linux
kernel source on nonstandard GNU C extensions is avoided in their
The text is easy to follow, mostly because the Linux implementation
of these facilities is pretty straightforward in the first place.
A strong point of the book is their coverage of the ext2 filesystem in
fine detail. The index is also excellent.
Two important areas are not covered at all, namely device drivers
and the network stack. There's already an O'Reilly book on
Linux device drivers, at least. The important topic of bootstrapping
is covered too lightly.
And they don't have any information at
all on how to build a kernel from source.
This is not a book for programmers who are familiar with other
implementations of UNIX; what they need to know about Linux could
probably be summarized in just a few bullet points:
But this book compares favorably with the classic Design of
the UNIX Operating System by Maurice Bach (Prentice-Hall, 1986)
as a practical introduction to kernel internals for those who
are new to the subject, and I strongly recommend it for any
programmer who's competent in C.
- Linux is non-preemptive in Kernel mode, apart from interrupt
handlers, which can run almost any time.
- System calls switch to an empty Kernel mode stack, as is usual
in UNIX implementations, rather than returning to an existing
Kernel mode context.
- Linux assumes a three-level page table for all architectures.
- Process structures and Kernel mode stacks are kept together in
a single contiguous block of memory.