Chapter 1: Getting Started with a Simple Character Device Driver
This chapter contains 2 sections. Click the links below to read:
Chapter 1: Crossing the Boundary: The First Step from User Space to the Kernel
1.1 Writing a Simple misc Character Device Driver
.2 Technical Preparation and Environment
Before we actually start writing code, we need to ensure our environment is ready and mentally prepare for the "beast" we are about to face—the Linux kernel driver model.
Chapter 2: Kernel and User Space Communication
This chapter contains 3 sections. Click the links below to read:
Chapter 2: The Kernel-User Boundary
2.1 The Cost of Communication
.2 Technical Preparation and the Communication Path Landscape
Before we dive in, we need to make sure our tools are ready.
.3 Questions
Alright, close the books — the theory is over. Now it's time to get our hands dirty.
Chapter 3: Hardware I/O Memory Access
This chapter contains 2 sections. Click the links below to read:
Chapter 3: Beyond Memory — When the Kernel Reaches for Hardware
In this chapter, we tackle the "last mile" problem of driver-hardware communication.
.2 Accessing Hardware I/O Memory in the Kernel
Let's get straight to the point.
Chapter 4: Hardware Interrupt Handling
This chapter contains 3 sections. Click the links below to read:
Chapter 4: Hardware Interrupts and the Kernel's Response Strategy
Imagine this scenario.
.2 Technical Preparation and the Truth About Kernel Interrupt Handling
In the previous section, we discussed a lot of theory about the "doorbell"—what interrupts are, how the CPU responds, and how the kernel stack switches. Now, let's bring our focus back to reality. As driver developers, we don't directly wire up those cables; that's the job of the kernel hardware layer and the BSP. What we actually interact with is an abstraction layer provided by the kernel.
.3 Exercises and Reflections
If you've made it this far, the mechanisms should be clear—or so you might think. This section is where we put theory to the real test. The exercises below increase in difficulty. We recommend thinking through them independently before checking the hints, and only referring to the hints if you get stuck.
Chapter 5: Kernel Delays and Time Management
This chapter contains 2 sections. Click the links below to read:
ch05_1
Chapter 5 Timers, Threads, and Workqueues
Chapter 5: Time and Asynchronous Work in the Kernel
Section 2 — Technical Preparation and Environment
Chapter 6: The Cost of Exclusion: Critical Sections and Atomicity
The Narrative Core of This Chapter
Chapter 7: Atomic Operations and Memory Barriers
This chapter contains 3 sections. Click the links below to read:
Chapter 7: The Art and Pitfalls of Lock-Free Programming
There is a class of problems that appear to be engineering challenges, but are actually limitations of understanding.
.2 Memory Barriers in Practice: A Careful Conversation with Hardware
In the previous section, we discussed how to safely manage reference counts, but in the world of kernel synchronization, beyond the lifecycle of data structures, there is another area that gives hardware driver developers headaches: communicating with the outside world.
.3 Further Reading and Resources
We've now touched on the most critical—and most explosive—parts of the kernel's concurrency and synchronization mechanisms. From simple atomic variables to complex memory barriers, from the busy-waiting loops of spinlocks to the deferred freeing of RCU, these mechanisms form the bedrock of kernel stability.