The Fundamentals
A from-first-principles book for low-level systems and networking engineers: the C language as it really runs, the CPU, memory and caches, the OS and kernel, buses and DMA, networking, high-performance networking, and lock-free concurrency. Every section is referenced.
- 1📜 C and the Machine
The C language as it actually runs on hardware: the build pipeline, types, pointers, memory layout, the ABI, allocation, and undefined behavior.
Why C, and how to read this chapter · The compilation pipeline · Types, integers, and representation · Pointers and memory addresses · The memory layout of a process · Structs, unions, and bitfields · The stack, calls, and the ABI · Dynamic memory and allocators · Undefined behavior and the optimizer · The toolchain in practice
- 2🧮 The CPU
How a modern processor really executes your code: the ISA, the pipeline, out-of-order and speculative execution, SIMD, interrupts, and how C becomes assembly.
The processor under your code · ISA vs microarchitecture · The instruction execution cycle · Pipelining and hazards · Superscalar, out-of-order execution · Branch prediction and speculation · SIMD and data parallelism · Interrupts, exceptions, and privilege · Clocks, power, and performance counters · From C to assembly
- 3🗄️ Memory & Caches
The memory hierarchy that dominates performance: caches and locality, virtual memory and the TLB, coherence, the C memory model, barriers, and NUMA.
Memory is the bottleneck · The memory hierarchy and its latencies · How caches are organized · Locality, layout, and prefetching · Virtual memory and paging · The TLB and translation cost · Cache coherence · The memory model and atomics · Memory barriers and ordering · NUMA and remote memory
- 4🐧 The Operating System & Kernel
What the OS does beneath your program: processes and threads, syscalls, scheduling, memory management, interrupts, drivers, the network stack, and observability.
What the kernel does for you · Processes, threads, and address spaces · System calls and mode switches · Scheduling · Memory management in the OS · Interrupt handling in the kernel · Device drivers and the driver model · The Linux network stack · Time, timers, and clocks · Observability and tracing
- 5🔌 Buses, Devices & DMA
How the CPU talks to hardware: MMIO and port I/O, PCIe topology and config space, TLPs, device interrupts, DMA and bus mastering, the IOMMU, and descriptor rings.
Talking to hardware · MMIO vs port I/O · PCI/PCIe topology · Config space, BDF, and BARs · PCIe transactions: TLPs · Device interrupts: INTx, MSI, MSI-X · DMA and bus mastering · The IOMMU · Descriptor rings and doorbells · Drivers, kernel and userspace
- 6🌐 Networking Fundamentals
From the wire up: the layered models, Ethernet and the PHY, switching and ARP, IP and routing, UDP and TCP, the socket API, and the tools to see it all.
How machines talk · Layered models and encapsulation · Ethernet, MAC, and the PHY · Switching, ARP, and the LAN · IP: addressing and routing · UDP and the datagram model · TCP: reliability and control · The socket API and the data path · Names, ports, and how an app connects · Tools of the trade
- 7🤝 TCP in Depth
A deep dive into the protocol that carries most of the internet: the connection state machine, sequencing and SACK, loss detection and timers, flow and congestion control, the bandwidth-delay product, options, and how TCP meets a modern NIC.
The reliable-stream illusion · Connections: handshake, state machine, teardown · Sequence numbers, ACKs, and SACK · Loss detection and retransmission · Flow control and the sliding window · Congestion control: AIMD, CUBIC, BBR · Throughput, the BDP, and bufferbloat · Options: scaling, timestamps, TFO, MPTCP · TCP and the NIC: TSO, GRO, RSS, timestamps · Observing and debugging TCP
- 8🚦 Congestion Control
How senders share a finite network without collapsing it: congestion collapse and the AIMD feedback loop, slow start and congestion avoidance, loss-based recovery, CUBIC for high-BDP paths, BBR and delay-based control, and fairness, AQM, ECN and datacenter congestion.
Why congestion control exists · Slow start, congestion avoidance, AIMD · Loss as a signal: fast retransmit and recovery · CUBIC and the high-BDP era · BBR and delay-based control · Fairness, AQM, and datacenter congestion
- 9⚡ High-Performance Networking
Where the standard stack runs out: why it's slow, interrupt mitigation and polling, zero-copy and batching, kernel bypass (DPDK, Onload/ef_vi), XDP, RDMA, and tail latency.
When the kernel stack isn't enough · Why the kernel stack is slow · Interrupt mitigation and polling · Zero-copy and batching · Kernel bypass: DPDK · Kernel bypass: Onload and ef_vi · XDP and eBPF fast paths · RDMA and the verbs model · Latency, throughput, and tail latency · AI and HPC fabrics
- 10🔗 Concurrency & Lock-Free Programming
Sharing state correctly and fast: races, locks and their costs, atomics and CAS, the memory model applied, SPSC/MPMC rings, the ABA problem, RCU, and false sharing.
Why concurrency is hard · Threads, shared state, and data races · Mutual exclusion and locks · Atomics and compare-and-swap · The memory model, applied · The SPSC ring buffer · MPMC rings and the ABA problem · RCU and deferred reclamation · False sharing and cache-aware concurrency · Patterns and pitfalls