Linux,
inside out.

A source-guided systems textbook, from your first terminal command through the kernel, userspace and Wine.

Open to everyone. Built for the curious.

Applications and libraries request services through defined interfaces.

Read about userspace
Select a layer. Follow it into the source.

168 source-cited chapters across 21 connected parts. Start with the foundations and follow the source.

A path into the system

Start with the foundations. Follow the source deeper.

0 of 168 read

Build a foundation in Unix processes, C objects, machine execution, source navigation and safe labs.

Explore chapters
  1. What Linux actually is8 min
  2. A workstation, shell, and safe habits8 min
  3. Files, processes, permissions, and everyday tools15 min
  4. Read kernel C: pointers, objects, and lifetime14 min
  5. From C to ELF, linking, and the ABI15 min
  6. CPU privilege, caches, memory, and I/O13 min
  7. Navigate Git and the Linux source tree13 min
  8. Build a disposable QEMU kernel laboratory15 min

Follow configuration and compilation through architecture-specific boot, system calls and process creation.

Explore chapters
  1. Kbuild, toolchains, and reproducible builds13 min
  2. Kconfig, modules, symbols, and compatibility14 min
  3. x86 boot: firmware to start_kernel13 min
  4. arm64 boot, firmware, and architecture contracts14 min
  5. initcalls, initramfs, PID 1, and userspace13 min
  6. System-call entry, dispatch, and user copies14 min
  7. execve, ELF loading, and process images14 min
  8. task_struct, clone, exit, and wait14 min

Explain CPU scheduling, interrupt contexts, timekeeping, deferred work and sleeping rules.

Explore chapters
  1. Runqueues, scheduling, and context switches13 min
  2. Fair scheduling and EEVDF13 min
  3. Real-time, deadline, and priority inversion14 min
  4. SMP, topology, affinity, and CPU placement13 min
  5. Interrupts, exceptions, softirqs, and NMI14 min
  6. Clocksources, timers, NO_HZ, and timekeeping13 min
  7. Workqueues, kernel threads, and deferred work14 min
  8. Locks, waiting, completions, and sleeping rules14 min

Reason about memory ordering, lifetime, lock validation and virtual memory behavior.

Explore chapters
  1. Atomics, barriers, and the Linux memory model13 min
  2. RCU, references, and safe object reclamation14 min
  3. Lockdep, preemption, and PREEMPT_RT14 min
  4. Address spaces, VMAs, and page tables15 min
  5. Page faults, copy-on-write, and anonymous memory14 min
  6. Zones, buddy allocation, compaction, and CMA14 min
  7. Reclaim, swap, pressure, and the OOM killer13 min
  8. NUMA policy, huge pages, and memory placement14 min

Follow kernel allocation and VFS objects through pathname lookup, file I/O and filesystem design.

Explore chapters
  1. Slab, vmalloc, per-CPU storage, and kernel allocation15 min
  2. Folios, page cache, file mappings, and writeback15 min
  3. VFS objects, file descriptors, and open files16 min
  4. Path lookup, dentries, RCU-walk, and permissions16 min
  5. Buffered I/O, direct I/O, and the file-operation boundary15 min
  6. Mounts, superblocks, propagation, and namespaces15 min
  7. ext4, extents, JBD2, and recovery15 min
  8. Btrfs, XFS, OverlayFS, and filesystem trade-offs17 min

Trace block requests and durability alongside processes' communication and event interfaces.

Explore chapters
  1. The block layer, requests, and blk-mq14 min
  2. bio, scatter-gather, DMA, and I/O completion13 min
  3. NVMe, SCSI, SATA, and storage-driver lifecycles13 min
  4. Device mapper, MD RAID, encryption, and stacked storage13 min
  5. fsync, ordering, failure, and crash consistency14 min
  6. Pipes, Unix sockets, SysV/POSIX IPC, and shared memory14 min
  7. Signals, pidfds, sessions, and job control13 min
  8. Futexes, poll/epoll, eventfd, and io_uring17 min

Follow packets from sockets through transport, routing, device queues and network policy.

Explore chapters
  1. Sockets, sk_buff, and the networking stack15 min
  2. TCP state, queues, congestion, and loss recovery15 min
  3. UDP, IPv4, IPv6, fragmentation, and checksums15 min
  4. Routing, neighbours, policy, and netlink14 min
  5. net_device, NAPI, queues, and offloads16 min
  6. Netfilter, conntrack, NAT, and nftables16 min
  7. Traffic control, qdiscs, XDP, and network BPF16 min
  8. Network namespaces, veth, bridges, tunnels, and virtual networks15 min

Study device discovery, buses, resource ownership, interrupts and power management.

Explore chapters
  1. Devices, drivers, kobjects, sysfs, and hotplug15 min
  2. Platform drivers, Device Tree, and ACPI16 min
  3. PCI/PCIe discovery, resources, and error handling16 min
  4. DMA mappings, IOMMUs, MSI, and device ownership14 min
  5. Character devices, TTYs, terminals, and input15 min
  6. USB enumeration, URBs, drivers, and disconnect16 min
  7. I2C, SPI, GPIO, pinctrl, and regmap15 min
  8. Runtime PM, suspend, clocks, regulators, and thermal policy15 min

Compare specialized multimedia, wireless and embedded subsystems with portability concerns.

Explore chapters
  1. DRM/KMS, GPUs, dma-buf, and fences15 min
  2. ALSA, PCM, ASoC, and audio timing16 min
  3. V4L2, media graphs, cameras, and video buffers14 min
  4. Wi-Fi, cfg80211/mac80211, Bluetooth, and rfkill14 min
  5. IIO, hwmon, RTC, watchdog, and hardware monitoring13 min
  6. MTD, raw flash, UBI/UBIFS, and embedded storage14 min
  7. Remote processors, rpmsg, mailbox, and FPGA14 min
  8. Rust for Linux, architecture ports, and portability16 min

Analyze credentials, security policy, resource isolation and virtualization boundaries.

Explore chapters
  1. Credentials, capabilities, user namespaces, and authority14 min
  2. LSM hooks, SELinux, AppArmor, and policy13 min
  3. Seccomp, Landlock, audit, and sandbox boundaries14 min
  4. Crypto API, keys, randomness, and trust15 min
  5. Secure Boot, lockdown, signatures, IMA, and EVM14 min
  6. Namespace lifecycles and the cgroup v2 model14 min
  7. cgroup controllers, PSI, limits, and delegation16 min
  8. KVM, vCPUs, stage-two translation, and VM exits14 min

Use virtual I/O, tracing and testing tools to gather and interpret bounded evidence.

Explore chapters
  1. Virtio, vhost, VFIO, and IOMMU-backed assignment14 min
  2. BPF syscalls, verifier, maps, JIT, and lifetime13 min
  3. ftrace, tracepoints, perf, and measurement semantics14 min
  4. BPF tracing, BTF, CO-RE, and observability limits14 min
  5. Oops, panic, vmcore, kdump, and kernel debugging14 min
  6. KASAN, KCSAN, UBSAN, kmemleak, and fault injection13 min
  7. KUnit, kselftest, syzkaller, and regression evidence14 min
  8. Experimental design for kernel performance13 min

Practice cross-subsystem investigations, maintenance, review and independent learning.

Explore chapters
  1. Userspace contracts, systemd, distributions, and containers14 min
  2. End-to-end storage and network investigations13 min
  3. Hardening, reliability, threat models, and operational limits13 min
  4. Livepatch, CPU/memory hotplug, and RAS14 min
  5. Kernel Git, maintainers, stable, and upstream workflow12 min
  6. Reviewing patches, bisection, testing, and responsible fixes12 min
  7. Evidence-based cross-subsystem capstones13 min
  8. The subsystem atlas and a path to independent expertise23 min

Map userspace libraries, tools, processes and service interfaces through pinned source.

Explore chapters
  1. The Linux userspace map and project baselines14 min
  2. libc, system calls, threads, and allocation15 min
  3. Dynamic loading, linking, and symbol versions14 min
  4. Bash, coreutils, pipelines, and job control15 min
  5. Userland toolchains and build systems13 min
  6. Packages, dependency solving, and distributions15 min
  7. D-Bus messages, brokers, and sd-bus14 min
  8. Trace and debug userspace boundaries15 min

Follow service management, activation, logging and device events in systemd.

Explore chapters
  1. Inside systemd's manager and unit loader15 min
  2. Jobs, dependencies, and transactions15 min
  3. Service types, readiness, and restart policy15 min
  4. Socket, timer, and path activation14 min
  5. Service isolation, cgroups, and user managers14 min
  6. Journals, logging, and userspace coredumps14 min
  7. udev events, rules, and device lifecycles14 min
  8. logind, seats, sessions, and login14 min

Investigate authentication, authorization, network configuration and userspace storage.

Explore chapters
  1. PAM, NSS, authentication, and accounts14 min
  2. Polkit, authorization agents, and bus policy14 min
  3. NetworkManager, networkd, and address configuration14 min
  4. Name resolution, DNS, and systemd-resolved15 min
  5. OpenSSH, authentication, channels, and agents14 min
  6. UDisks, GVfs, and desktop storage14 min
  7. cryptsetup, LUKS, and encrypted storage14 min
  8. libfuse, SSHFS, and userspace filesystems13 min

Follow application graphics, display protocols, compositors and input routing.

Explore chapters
  1. The userspace graphics path and libdrm15 min
  2. Mesa, DRI, Gallium, and driver loading14 min
  3. Vulkan, OpenGL, EGL, GBM, and presentation14 min
  4. Wayland objects, protocol, and wire format15 min
  5. Wayland surfaces, buffers, and event dispatch15 min
  6. Compositor architecture and scene pipelines13 min
  7. libinput, XKB, and seat input routing14 min
  8. X11, Xorg, window managers, and Xwayland13 min

Study desktop application toolkits, sessions, portals and data transfer.

Explore chapters
  1. Graphics synchronization, color, and HDR13 min
  2. Fonts, shaping, text, and rasterization14 min
  3. GTK, GObject, and GLib event loops15 min
  4. Qt objects, events, and platform plugins14 min
  5. Desktop launchers, XDG, and app activation14 min
  6. Desktop portals, permissions, and accessibility14 min
  7. Display managers and graphical sessions14 min
  8. Screen locking, selections, and clipboard boundaries15 min

Trace audio and media graphs, policy, compatibility and capture security.

Explore chapters
  1. ALSA userspace and audio device interfaces13 min
  2. PipeWire core, objects, and native protocol14 min
  3. PipeWire graphs, buffers, and real-time scheduling14 min
  4. WirePlumber and session policy14 min
  5. PulseAudio, JACK, and PipeWire compatibility14 min
  6. BlueZ, Bluetooth services, and audio routing14 min
  7. GStreamer, FFmpeg, and media pipelines13 min
  8. Capture portals, WebRTC, and media security15 min

Connect application runtimes, services and isolation in end-to-end investigations.

Explore chapters
  1. Follow a desktop session end to end15 min
  2. Flatpak, bubblewrap, and application sandboxes13 min
  3. OCI runtimes, runc, and Podman14 min
  4. QEMU, libvirt, and userspace virtualization15 min
  5. Browsers, rendering processes, and sandboxes14 min
  6. CUPS, printing pipelines, and IPP13 min
  7. Event-driven servers and embedded databases14 min
  8. Userspace investigations and the project atlas16 min

Explain Wine's process, loader, object and Windows API compatibility boundaries.

Explore chapters
  1. Wine architecture, prefixes, and trust boundaries13 min
  2. PE/COFF loading, DLLs, and imports14 min
  3. ntdll, Unix calls, and syscall translation14 min
  4. wineserver, processes, threads, and handles14 min
  5. Windows waits, synchronization, and Linux primitives14 min
  6. Virtual memory, Unix signals, and Windows exceptions14 min
  7. Files, registry, object paths, and authority14 min
  8. Windows services, Winsock, and IPC16 min

Study Wine graphics, integration and evidence-based compatibility debugging.

Explore chapters
  1. WoW64, mixed bitness, and architecture boundaries14 min
  2. Wine windowing, Wayland, X11, and input14 min
  3. Direct3D, wined3d, and OpenGL14 min
  4. DXVK, vkd3d-proton, and Vulkan translation15 min
  5. Windows audio, media, and device integration13 min
  6. COM, OLE, .NET boundaries, and installers13 min
  7. Proton, the Steam runtime, and compatibility policy13 min
  8. Wine debugging, conformance tests, and capstone14 min

Before you begin

Choose your lab, learn how checkpoints work, and read safely.

This book guides a computer science graduate from basic Unix and C through Linux kernel internals, userspace services, desktops, applications and Wine toward independent systems investigation. It is a long apprenticeship, not a certification or a guarantee of expertise. The similarly named Linux From Scratch project teaches readers to build a Linux distribution; this is a separate Linux kernel curriculum, not its official guide. No finite book covers every driver, architecture, application, configuration, or release.

Baseline and evidence#

The kernel historical teaching baseline is upstream Linux v6.12, with versioned documentation. It is not a recommendation to deploy an unpatched kernel. A distribution may backport fixes and behavior without changing the apparent upstream version; a current kernel may have moved or replaced the code. Userspace and Wine projects have separate independently pinned source versions; they are not a jointly tested compatibility matrix. Pin tools separately when an exercise needs a particular version. When comparing another version, use Git to inspect the change and read its surrounding configuration rather than assuming names and paths are unchanged.

An annotated source path establishes what that version can do under stated conditions. It does not establish which path your machine executed. A runtime trace describes one observed execution, with its instrumentation, workload and losses; it does not establish all possible executions. Separate direct evidence, inference, synthetic examples and unanswered questions in your notes. The chapter diagrams are teaching models, not captured executions unless explicitly stated. The figure below sorts the evidence kinds used in this curriculum and what each can and cannot show.

Kinds of evidence
Source at a tag
What the v6.12 code implements under stated conditions; it does not show which path your machine ran.
Configuration
Your .config, architecture, compiler and patches decide which paths exist on a given system.
Runtime observation
One captured output from one host; it does not establish all possible executions.
Synthetic example
A labeled teaching program or invented input; useful for practice, not a measurement.
Open question
What remains unverified, with the next check that would settle it.
Conceptual model. Teaching model for the evidence kinds used in this curriculum (Linux v6.12 baseline), not a captured trace.

What makes a Linux system#

Linux is the kernel: it manages processes, memory, devices and interfaces used by programs. A shell, compiler, C library and utilities are userspace programs; many systems use GNU components, but neither GNU nor any particular shell is the kernel. The C library often supplies the convenient function that prepares a system call and translates a negative kernel error into userspace errno. A distribution selects a kernel, configuration, patches, libraries, package manager, services and update policy. Firmware and a bootloader prepare a machine and hand control to the kernel according to an architecture-specific contract; they are not interchangeable with PID 1, the first userspace process.

This boundary matters when debugging. A shell's command not found, a dynamic loader's missing-library error, a rejected system call, and a device driver's error may look like one failed command, yet require different evidence. Identify the layer and version before attributing a failure to Linux itself.

A multi-year study plan#

These are planning ranges for roughly 5–10 focused hours per week, not promises. The original kernel phases total approximately 25–50 months and 1,090–2,150 hours; the userspace and Wine phases add roughly 24–48 months and 1,040–2,050 hours; overlap, prior systems work, interruptions and hardware availability change elapsed time. Some investigations take far longer. A source-only learner can complete reading gates while recording runtime work as pending.

PhaseParts and entryApproximate effortEvidence to retain
Foundations1–2: system map, build and boot3–6 months, 120–250 hoursShell and C notes, source navigation, a build record or documented blocker
Execution and memory3–4: scheduling, memory ordering4–8 months, 180–350 hoursScheduling timeline, synchronization and fault explanations
Files and I/O5–6: allocation, block I/O4–8 months, 180–350 hoursVFS and storage maps, crash-consistency hypothesis
Networks and devices7–8: sockets, driver model4–8 months, 180–350 hoursPacket path and device ownership diagrams
Specialization and isolation9–10: graphics, credentials4–8 months, 180–350 hoursOne subsystem study and a bounded security model
Investigation and practice11–12: virtual I/O, systems engineering6–12 months, 250–500 hoursMeasurement record, review exercise and capstones
Userspace and services13–15: userspace map, systemd, identity and networking6–12 months, 260–500 hoursSource-pinned service and authorization paths
Desktop and media16–18: graphics, toolkits, audio8–16 months, 340–650 hoursBuffer, event-loop and audio graph ownership maps
Applications and Wine19–21: applications, Wine architecture, Wine graphics10–20 months, 440–900 hoursUserspace capstone, compatibility evidence and Wine capstone

Read the first four parts in order. Later, specialize and revisit foundations when a dependency is unclear. The kernel research atlas and userspace project atlas are starting maps for choosing a next question, not a complete list of Linux expertise.

Prerequisite matrix#

Starting pointFirst targetReturn when needed
New to shell or C pointersPart 1Shell, C objects, lifetime and ABI
Comfortable with C and UnixReview Parts 1–2Architecture, configuration and boot contracts
Familiar with kernel developmentPart 3 onwardBaseline, execution context and version differences
Investigating a particular subsystemIts part after core executionMemory, locking, ownership and lifetime

Weekly study routine#

A practical five-session cycle is read, trace, experiment, explain, review. First read the chapter and source with unfamiliar terms recorded. Next choose a single operation and follow a normal path and a meaningful error branch; record the configuration and how any indirect call is selected. Then run a bounded exercise appropriate to your route, or analyze the supplied source-only example. Write down expected results before looking at observations. Explain the path in your own words and draw the objects and their owners. Finally answer the knowledge check without the text, compare your explanation to the cited source, and revise the notebook with unresolved questions. An hour of careful tracing can be more useful than a day of collecting names.

Gates at part boundaries#

Each gate asks for an artifact and an explanation to another person or to your future self. Use the chapter checkpoints for detailed criteria. If you cannot explain a dependency, return to its prerequisite, work a smaller example and retry; do not mark a failed runtime experiment as a pass merely because source reading was possible.

PartArtifact and readiness gate
1Explain a process, file descriptor and pointer lifetime; retain a safe shell transcript and source map.
2Draw build-to-PID-1 and syscall-to-exec paths, with configuration and one failure branch.
3Explain a wakeup, scheduling decision and deferred-work context using a timeline and lock assumptions.
4Explain a publication/lifetime argument and a fault-to-page-table path with a counterexample.
5Trace pathname, VFS objects and a filesystem operation, including references and an error.
6Trace a storage request and distinguish completion from persistence; compare two IPC lifetimes.
7Map a packet from socket through device or policy and name namespace and configuration boundaries.
8Explain device discovery, resource ownership and safe teardown for a selected bus and driver.
9Produce a focused subsystem map with its userspace interface and portability limitations.
10Analyze authority, isolation and one virtualization boundary with an explicit threat model.
11Produce a measurement and testing plan identifying instrumentation effects and untested paths.
12Present a reproducible investigation or reviewable patch analysis, including alternatives and remaining uncertainty.
13Trace a libc, loader or bus request across process boundaries and one error.
14Explain a unit, job and service readiness timeline with a cleanup case.
15Separate authentication, authorization, network and storage service authority.
16Explain a display buffer's commit, ownership and release with a protocol boundary.
17Trace an application event through toolkit, session and portal state.
18Explain a media graph's buffer and policy lifecycle with an interruption.
19Present a bounded cross-project investigation and competing explanations.
20Trace a Wine object or handle through an ABI and lifetime boundary.
21Present a compatibility hypothesis with a controlled test plan and explicit untested cases.

These are evidence gates, not examinations administered by kernel maintainers. Source-only completion demonstrates source analysis under the stated assumptions; it does not demonstrate a boot, a measured result, operational competence, or expert qualification.

Choose a lab route#

Source-only requires a browser or a checkout of the tagged source and time to draw and explain paths. Supplied worked cases provide evidence even without a compiler or VM. Own-host read-only exercises use ordinary permissions, your own short-lived processes and observations such as /proc; results describe your host kernel, not automatically v6.12. Avoid exposing other users' process details in shared notes.

Disposable guest work uses an x86-64 QEMU guest, a separate kernel, initramfs or disk image, and an ordinary unprivileged host account. Label host and guest terminals, prompt, working directory and image paths before every command. Never give a physical disk, host mount, host firewall, host sysctl or host kernel module to a destructive exercise. Keep a clean image copy and retain logs; stop the VM and discard only lab copies to recover. Filesystem mutation, networking changes, crashes, fuzzing, hotplug and module insertion belong in a disposable guest or disposable image. A guest is not a substitute for backups or a security boundary against a hostile workload.

Chapter 08 specifies packages, resources and a reproducible intended build and boot. Its v6.12 kernel has not been successfully booted in the recorded author environment. Attempts using GCC 16 failed on C23-related build errors with both EFI and non-EFI configurations; the documented Ubuntu 24.04/GCC 13 alternative remains unverified here. Preserve the exact error, config and tool versions if your attempt fails; do not assume the VM will start immediately. No PID 1 or guest /proc output is claimed as observed by the authors.

Wine route: use only self-authored test programs in a new private prefix when the relevant tools are available; a Wine prefix is not a security sandbox. The authors did not run Wine, Windows conformance or the PE labs. Record a source-only result when those tools are unavailable.

Hardware and architecture contrast may require a suitable board, serial access, recovery media and device-specific documentation. arm64 source can be studied without hardware; an arm64 guest needs its own build, machine and firmware choices. Check access and recovery before trying hardware. Build time, disk space and RAM depend on configuration and parallelism; chapter 08 gives concrete starting budgets. A C toolchain, Git and optionally QEMU, BusyBox and readelf support different exercises; none is required for the source-only route.

Reading the code and keeping a notebook#

Start at a named interface and locate its definition, callers and relevant data structure. For each call, check the active Kconfig option, architecture, compile-time alternatives and runtime state. Follow function-pointer initialization to a specific operations table before claiming a target; macros, inline functions, generated files and static calls make a text search incomplete. Read both the callee and its callers, then trace resource acquisition and unwind in reverse order. Compare tags with Git history when a symbol is absent. A search returning no matches is a question about scope and spelling, not proof that a behavior cannot happen.

Use this notebook template for every investigation:

text
Question and expected observation:
Source tag/commit, files and symbols:
Architecture, CONFIG options, compiler, boot arguments and tool versions:
Caller, execution context and indirect-call selection:
Objects, owners, references, locks and lifetime:
Normal path and conditional branches:
Error, cancellation or teardown path:
Evidence: source / synthetic model / actual command and captured output:
Interpretation, limits, competing explanation and next check:

For example, ask why an invalid descriptor fails on a read. At v6.12 inspect ksys_read in fs/read_write.c, record how a descriptor is looked up and what happens if lookup fails, and distinguish the caller's descriptor number from the referenced open-file object. State whether you only inspected source or ran a userspace program, and capture that program's host kernel and return value. A trace of one failed call cannot establish the behavior of all filesystems or all versions. As you learn locking and references, add their exact lifetime and context rather than retroactively calling an early sketch complete.

How to read and measure progress#

Each chapter has prerequisites, goals, a source walkthrough, practice, questions, answers, a checkpoint and sources. Use search and the glossary to return to a term; the outline follows chapter headings. Theme, reading size, focus mode and completion marks are stored locally in your browser. A completion mark is a bookmark, not proof of competence. Printing produces a paper-friendly chapter view. For further work consult the kernel development process guide and the relevant subsystem maintainers' documentation, then verify against the version you actually use.