From running programs to understanding the kernel
The goal is to explain what the kernel does when a program runs, requests memory, waits for a file, or competes with another program. Knowing subsystem names is insufficient: you should show control flow, state changes and the reason for a design choice in code and in an observation.
Scope and prerequisites
This course concerns the Linux operating-system kernel. Linux is the destination; xv6 on RISC-V is a small model for studying mechanisms, whose details must not be assumed to match Linux. RISC-V instructions differ from x86-64 instructions. Linux internal interfaces and source paths depend on the version; the lab chapter will pin a source commit and architecture.
The learner's level has not yet been assessed. Knowing what a program and memory are is enough for lesson one. Before source reading, you need pointers, structs, bits, functions and the command line. The proposed workload is about 140 hours: roughly 24 weeks at six hours per week or 14 weeks at ten hours per week. These estimates include exercises: 126 hours for the table modules, two hours for lesson one, and twelve hours for assessment, review and prerequisite catch-up.
Entry assessment
Answer without searching: How does a program differ from a process? What does a pointer point to, and what limits its lifetime? How does RAM differ from a file? Why should an infinite loop not freeze the computer? Does every function call enter the kernel? What could go wrong when two threads increment one counter?
Answer guide: a program is an executable description; a process is an executing instance with resources. A pointer is an address subject to object validity and lifetime constraints. RAM is working memory; a file is a named data abstraction, not necessarily data currently on disk. Preemptive scheduling lets the system reclaim CPU time. An ordinary call need not be a syscall. A compound increment can lose an update. If at least three answers are unfamiliar, complete both prerequisite modules. This assessment does not save personal grades.
Lesson method
Follow this sequence: original problem and historical motivation; model and vocabulary; step-by-step trace; prediction; observation and comparison; source reading at a recorded revision; transfer to a new problem.
Before advancing, draw the mechanism without notes, predict the effect of a change, and refute one misconception with a counterexample. A successful experiment without a causal explanation is insufficient.
Complete plan
Ready to begin: Why do we need a kernel?. C for reading kernels is also ready; its example has not yet been executed. The machine underneath the OS is also ready; its assembly trace is a manual analysis, not a hardware run. All other modules in the table remain planned without full lessons.
| Module | Concepts | Assessable output | Hours |
|---|---|---|---|
| C and code-reading tools | Pointers, lifetimes, structs, bitwise operations, stack and heap | Trace a linked list and identify a use-after-free on paper | 6 |
| The machine underneath the OS | Registers, PC, ABI, assembly, caches and the MMU | Explain a load and distinguish virtual from physical addresses | 6 |
| A reproducible lab | Linux VM, compiler tools, GDB, QEMU and version records | Record uname and the source commit; run a user program and boot the teaching environment | 4 |
| From power-on to init | Firmware, bootloader, architecture entry, start_kernel and PID 1 | Draw the boot path and separate firmware duties from kernel duties | 6 |
| Entering the kernel | System-call ABI, traps, exceptions and interrupts | Trace write from user space through architecture entry to its service | 8 |
| Processes and threads | task_struct, fork/clone, exec, exit and wait | Compare resources shared by threads and fork children | 8 |
| Scheduling and context switching | Task states, preemption, run queues, fairness and latency | Draw a timeline for two CPU-bound tasks and one I/O-bound task | 8 |
| Virtual memory | Page tables, TLBs, page faults, mmap and copy-on-write | Explain mappings at fork and at the first write | 10 |
| Allocation and reclaim | Physical pages, buddy allocation, slab allocation, reclaim and OOM | Distinguish allocation failure from an invalid-address fault | 6 |
| Concurrency inside the kernel | Races, atomics, spinlocks, mutexes, ordering, RCU and deadlocks | Construct a failing interleaving and justify a locked invariant | 12 |
| Interrupts and devices | IRQs, interrupt context, deferred work, DMA and buffer lifetime | Draw buffer ownership between CPU and device | 8 |
| From files to storage | Descriptors, open file descriptions, VFS, inodes, page cache and block I/O | Separate write completion, caching and crash durability | 10 |
| Networking inside the kernel | Sockets, packet buffers, receive/transmit paths and backpressure | Trace a TCP message on loopback and explain the syscall boundary | 8 |
| Security and isolation | Credentials, capabilities, namespaces, cgroups and seccomp | Distinguish resource limits, authorization and namespace isolation | 6 |
| Observation and debugging | procfs, tracing, perf, ftrace, eBPF and observation limits | Answer a latency hypothesis with evidence and tool-overhead caveats | 8 |
| Capstone: one read from end to end | Combine syscalls, memory, VFS, waiting, IRQs and scheduling | Deliver a pinned-source report, trace and a one-variable experiment | 12 |
Four assessment gates
After kernel entry, distinguish function calls, syscalls, exceptions and IRQs on a timeline. After memory, trace an address access and analyze two different causes of page faults. After concurrency, state an invariant and a failing interleaving for shared state. At the end, compare a read satisfied from cache with a read waiting for I/O; support claims with traces and source from the same revision.
Project and environment
User-space exercises run in Linux; lesson-one commands are not PowerShell commands. Kernel modification and boot experiments belong in a virtual machine with a snapshot. Tool installation and VM setup have their own planned lesson; nothing has been installed by preparing this course. Record tool versions, architecture, the running kernel version and the source commit for every experiment. A host-kernel trace is not evidence about a guest kernel.
The capstone report contains a question, prediction, environment record, source path with function names, annotated trace, a one-variable change, findings and limitations. Rubric: mechanism accuracy 40%, reproducible evidence 30%, analysis of limitations 20%, clarity 10%.
Sources and reading order
Use the xv6 book and accompanying code for a readable model, OSTEP for reasoning practice, official Linux documentation to connect to the real implementation, and system-call manuals for external contracts. This is an independently authored learning path, not a translation of a book or MIT course. Sources checked on 2026-10-16; latest is not a fixed revision.