Linux Code Commentary ... in a nutshell
These books are rather old, so some bits are outdated, but don’t let this fact discourage you. Both can be super useful and can definitely help you learn more about how the Kernel works.
Linux Kernel In a Nutshell
The first one is a classic. Written by Greg Kroah-Hartman, one of the core Linux Kernel developers (who also took over as the lead of the project while Torvalds was away ), It doesn’t require any prior knowledge of Linux (or even programming) and guides the reader step by step into the process of building and configuring their kernel from source. Some of its subjects include:
- How to get the Kernel sources.
- How to use
- A short explanation into the most important
kconfigflags as well as heuristics for when to enable each of them.
- Miscellaneous tools that help in building, maintaining and patching your kernel.
What’s interesting about this book is that, it will give a short introduction
into each one of the technologies and hardware and the Linux kernel flags for
enabling/disabling support for them. Do you know what
Perhaps confused as to what the
lpj or the
cachesize CPU options are during
kernel configuration? This book will answer these questions.
This way you can learn about a bunch of components in just 20 pages (see
Chapter 8: Configuration Recipes) without having to jump to different webpages
and having to cross reference the validity of what’s you’re reading. Here are
some example topics:
- Types of supported filesystems (
- Types of supported filesystems (
Linux Core Kernel Commentary
While the Linux Kernel in a nutshell is a rather lightweight read, this is definitely not the case with the Linux Core Kernel Commentary. Counting 575 of awkward landscape A4 pages it includes large chunks of code along with separate pages with line-by-line explanation of the code.
What you will learn from it:
How to read assembly code
Even if you are unfamiliar going through assembly code, the book does a pretty good job at explaining how each one of the instructions work as well as offer alternative implementations of what’s you are currently reading in
Understand concepts like System Calls, Interrupts, and Virtual Memory. On top of that it shows you the actual code used in the kernel that implements these. The latter can be so helpful. It shifts the reader’s goal from “Let’s have a theoretical discussion about X” to “Let’s get down to the nitty-gritty details of how X is being done in a real-life production system”.
How Linux (well, at least its
2.3.12version) actually works.
The content can be broken up into two parts. The first half contains the raw
C and Assembly files from the kernel in a two-column format. The
second half contains the corresponding commentary for the selected files.
Based on these files, the book analyses the following subjects:
- Kernel Architecture Overview and Design Goals
- System Initializataion (What happens on system boot)
- System Calls (
- Signals and Interrupts and Time
- Processes and Threads (Process Representation, Scheduling)
- Memory (Virtual Memory, Paging, Memory Mapping)
- IPC (Message Queues, Semaphores, Shared Memory)
- Symmetric Multiprocessing
- Tunable Kernel Parameters
Here’s an example view of the code presented in the book (file:
The black arrow on the right side indicates the page to go for a more in-depth explanation. Here are the contents of the explanation pages:
It includes some introductory content about Interrupts and Signals and then it
goes line-by-line to explain what the purpose of the code is, what
Get both of them and at least have them in your bookcase. They are pretty cheap