What’s been added in the second edition?
A pretty huge amount of new material has been added into this, the Second Edition of the Linux Kernel Programming book. As well, being based on the very recent (as of this writing) 6.1 LTS release, its information and even code will remain industry-relevant for many, many years to come.
Here’s a quick chapter-wise summarization of what’s new in this second edition:
- Materials updated for the 6.1 LTS kernel, maintained until December 2026, and until August 2033 via the CLP (6.1 SLTS)!
- Updated, new, and working code for the 6.1 LTS kernel
- Several new info-rich sections added to most chapters, many new diagrams, and new code examples to help explain concepts better
- Chapter 1, Linux Kernel Programming – A Quick Introduction
- Introduction to the book
- Chapter 2, Building the 6.x Linux Kernel from Source – Part 1
- The new LTS kernel lifetime mandate
- More details on the kernel’s Kconfig+Kbuild system
- Updated approaches on configuring the kernel
- Chapter 3, Building the 6.x Linux Kernel from Source – Part 2
- More details on the
initramfs
(initrd
) image - Cross-compiling the kernel on an x86_64 host to an AArch64 target
- More details on the
- Chapter 4, Writing Your First Kernel Module – Part 1
- new-ish
printk
indexing feature covered - Powerful kernel dynamic debug feature introduced
- Rate-limiting macros updated (deprecated ones not used)
- new-ish
- Chapter 5, Writing Your First Kernel Module – Part 2
- A better, ‘better’ Makefile (v0.2)
- Chapter 6, Kernel Internals Essentials – Processes and Threads
- New linked list demo module
- Chapter 7, Memory Management Internals – Essentials
- New coverage on how address translation works (including diagrams)
- Chapter 8, Kernel Memory Allocation for Module Authors – Part 1
- Coverage on using the “exact” page allocator API pair
- FAQs regarding (slab) memory usage and their answers
- The graphing demo (via
gnuplot
) is now automated and even saved to an image file, via a helper script - Finding internal fragmentation (wastage) within the kernel
- Chapter 9, Kernel Memory Allocation for Module Authors – Part 2
- Extracting useful information regarding slab caches
- A word on slab shrinkers
- Better coverage on the OOM killer (and
systemd-oomd
) and how it’s triggered; includes a flowchart depicting demand-paging and possible OOM killer invocation - Better coverage on kernel page reclaim, as well as the new MGLRU and DAMON technologies
- Chapter 10, The CPU Scheduler – Part 1
- New coverage on CFS scheduling period and timeslice. Coverage on the thread_info structure as well
- New: the preempt dynamic feature
- Enhanced coverage on exactly how and when
schedule()
is invoked
- Chapter 11, The CPU Scheduler – Part 2
- Much more depth in the powerful cgroups (v2) coverage plus an interesting script to let you explore its content
- Leveraging the cgroups v2 CPU controller via both
systemd
and manually to perform CPU bandwidth allocation - A note on Google’s ghOSt OS
- Chapter 12, Kernel Synchronization – Part 1
- A new intro to the LKMM (Linux Kernel Memory Model)
- More on locking plus deadlock avoidance guidelines
- Chapter 13, Kernel Synchronization – Part 2
- Expanded coverage on CPU caching and cache effects
- New coverage on the powerful lock-free RCU synchronization technology
- Online Chapter, Kernel Workspace Setup
- Fixed errors in package names and versions
- Ubuntu-based helper script that auto-installs all required packages
Most (if not all) earlier code errors, typos, and URLs are now fixed, based on prompt feedback, raising Issues/PRs on the book’s GitHub repo, from you, our wonderful readers!