- Building Essential UNIX Tools
- Systems Infrastructure: Builds, Testing and Distribution
- Direct Memory Access and Binary Formats
- Processing Streams, Buffers and Data Encoding
- Navigating Directories and Filesystem Events
- Programming the Network Stack
- Managing Threads, Processes and Signals
- Orchestrating Concurrency and Synchronization
- Implementing Asynchronous I/O
- Building a High-Performance In-Memory Cache Server
- Persisting Structured Data with SQLite3
- Developing a Domain Specific Language
Puts Zig to work immediately by building three real UNIX utilities: ztee, a tee(1) clone; zwhich, a which(1) clone; and zpass, which demonstrates calling C code directly via @cImport(). Assumes working fluency with Zig and establishes the book's hands-on, tool-building approach from the first page.
Treats the build process as a first-class systems programming concern. Covers build.zig, string formatting with std.fmt, memory allocators, unit testing with std.testing, the development of zuuid and publishing packages using the Zig build system.
Bridges the gap between abstract variables and the physical machine. Covers pointer arithmetic, custom allocator design, endianness handling and binary file parsing, culminating in zunzip, a fully functional Zip file lister built from raw bytes. Closes with allocator benchmarks that connect architectural choices to real-world performance.
Shifts focus to I/O efficiency and stream processing through a suite of classic UNIX tools: zcat, zwc and z64 for Base64 encoding and decoding. Examines buffering strategies, the cost of system calls, SIMD-accelerated data processing and bitwise encoding logic.
Explores filesystem interaction at the level of OS primitives. Builds ztree, a recursive directory tree visualizer, and zwatch, a real-time file monitoring utility backed by Linux inotify or BSD kqueue. Concludes with implementations of chmod(1) and chown(8).
Works up from raw TCP/IP sockets to a complete System Monitor API. Builds a TCP echo server and client, a UDP echo server and client, Docker images for network services and a minimal HTTP server and client. Closes by showing how comptime can enforce protocol correctness at compile time.
Gives direct access to the OS process model through Zig's C interoperability layer. Covers UNIX signal handling, process creation with fork(2) and execve(2), shell command execution and a concurrent TCP server and client. All concepts converge in zcron, a minimal cron(8)-style job scheduler.
Examines the distinction between concurrency and parallelism and the practical consequences of getting it wrong. Covers mutexes, atomic operations, condition variables, thread pools, ring buffers and the Producer-Consumer pattern, culminating in zlocate, a concurrent file indexer using the Scatter-Gather pattern.
Addresses the fundamental scalability problem of synchronous I/O under high concurrency. Introduces Zig 0.16's async and await model, builds an asynchronous TCP proxy and includes platform-specific coverage of io_uring on Linux and kqueue on macOS.
Constructs zcache, a non-trivial in-memory cache built around three cleanly separated layers: an LRU storage engine, a custom binary wire protocol (ZEMP) and a thread-per-connection server. Develops three client tools that verify correctness, demonstrate usability and measure throughput and latency.
Moves from in-memory to persistent storage. Covers JSON reading and writing, parsing structured data into Zig types and connecting to SQLite3 through the C interoperability layer. Builds a complete note-taking service with an HTTP API and a dedicated client.
Closes the book by building zcalc, a small interpreted programming language, from scratch. Implements all three pillars of an interpreter — a Lexer, a Parser and a tree-walking Evaluator — and wraps them in an interactive REPL. A fitting capstone that draws on every technique introduced across the book.