Linux Systems Programming
A chaptered guide to Linux systems programming in modern C++, Go, and Rust โ processes, I/O, memory, IPC, networking, concurrency, debugging, containers, and observability, with runnable examples in all three languages.
What this tutorial is
A chapter-based, hands-on path through Linux systems programming for developers who already program and want to understand what their code asks of the kernel. Each chapter builds the same runnable example idiomatically in C++23, Go, and Rust โ processes, files and I/O, memory, IPC, networking, and concurrency, then debugging, containers, observability, and low-latency work. Everything runs locally on Fedora 44 except what genuinely needs root, kernel observation, or a second host โ that runs in a disposable KVM lab. eBPF appears as an observation toolkit (bcc-tools, bpftrace, bpftool) aimed at your own programs; this is systems programming, not kernel programming. All container images are UBI-based and run rootless under Podman.
Setting Up
Prepare a Fedora 44 workstation for three toolchains, provision the two-VM KVM lab for anything privileged, and stand up the Podman LGTM observability stack โ everything later chapters assume.
Foundations
What a system call really is, and the two disciplines this book never stops practicing โ how each language reports failure, and how each language shares work.
Files and I/O
From file descriptors and the VFS through the page cache, epoll event loops, and io_uring โ building fwatch, a real file watcher, one I/O model at a time.
Processes, Signals, Privilege
fork/exec/wait, safe signal handling, race-free pidfd supervision, and privilege dropping โ building pmon, a mini process supervisor that stays with us to the capstone.
Memory
Virtual address spaces, mmap and shared mappings, and what glibc malloc, Rust allocators, and the Go GC actually do โ with shmkv, a cross-language mmap-backed key-value store.
IPC
Pipes, FIFOs, UNIX sockets with fd passing, and shared-memory coordination with futexes and eventfd โ pmon grows a log pipeline and a control plane; shmkv goes multi-process.
Networking
TCP and UDP sockets from first principles to an epoll event loop and a two-VM peer-to-peer chat mesh โ plus the time, timers, and deadline discipline every networked program needs.
Concurrency in Depth
Down to the futex, up to lock-free rings and memory ordering, and out to async โ C++ coroutines on epoll, the Go scheduler, and tokio โ and when plain threads still win. The C++ treatment of these topics has been extracted into its own dedicated, runnable book, C++ Concurrency and Parallelism (patterncatalyst.github.io/cpp-concurrency-and-parallelism); the chapters here now point to it.
Debugging
gdb from core dump to remote gdbserver in the VM, valgrind versus sanitizers versus miri, an eBPF observation toolkit aimed at our own daemons, and each language's native toolbelt.
Containers and Virtualization
Namespaces, cgroup v2, seccomp, and Landlock as APIs our programs call โ then our daemons living inside Podman containers and the real trade-offs of containers versus KVM virtual machines.
Observability
From /proc, /sys, and cgroup stats through the USE method and eBPF tools to OpenTelemetry in all three languages, flowing into the local LGTM stack โ with Cockpit and Performance Co-Pilot alongside.
Performance and Low Latency
Benchmark without lying to yourself, strip a hot path down to pinned cores and zero allocation, and finish by assembling every artifact into a supervised, sandboxed, fully observed two-VM fleet.
Deep Dives
Language-specific excursions โ embedding Lua as a policy engine in all three languages, Rust macros for systems code, and the Go runtime from a systems programmer's seat.
Appendices: Tooling
Reference-depth guides to the analysis suites โ Cockpit, SystemTap, and Performance Co-Pilot โ and the full C++, Go, and Rust toolboxes that keep this book's examples sharp.
Compendium: C++ Concurrency
A C++-only compendium that takes one workload through every concurrency model the language offers โ pthreads, std threading, Boost.Thread, C++20 coroutines, Boost.Fiber, Boost.Asio. This compendium has been extracted into its own dedicated, runnable book, C++ Concurrency and Parallelism (patterncatalyst.github.io/cpp-concurrency-and-parallelism); the chapters here now point to it.