Systems Programming With Zig book

Systems Programming with Zig is Now Available!

After many months of writing, testing, and refining with the latest Zig language features, I am very excited to announce that “Systems Programming with Zig: Build Real Tools with No Hidden Cost” is now officially published!

This is a hands-on, practical book for developers who already know Zig basics and want to use the language for real systems programming work — building command line UNIX tools, network services, concurrent applications and more.

What the Book Covers Link to heading

The book assumes you are comfortable with Zig syntax and focuses on applying the language to systems-level problems. Every chapter builds something concrete and useful.

Chapter Overview:

  • Chapter 1 — Building Essential UNIX Tools
    tee(1) and which(1) clones + direct C interoperability with @cImport()

  • Chapter 2 — Systems Infrastructure: Builds, Testing and Distribution
    Mastering build.zig, allocators, testing, and publishing Zig packages

  • Chapter 3 — Direct Memory Access and Binary Formats
    Pointer arithmetic, custom allocators, endianness, and a zunzip utility

  • Chapter 4 — Processing Streams, Buffers and Data Encoding
    High-performance I/O with zcat, zwc, z64, buffering, and SIMD

  • Chapter 5 — Navigating Directories and Filesystem Events
    ztree and zwatch (using inotify / kqueue)

  • Chapter 6 — Programming the Network Stack
    TCP/UDP servers & clients, HTTP services, and Docker packaging

  • Chapter 7 — Managing Threads, Processes and Signals
    Signals, fork, execve, and a minimal cron-like scheduler (zcron)

  • Chapter 8 — Orchestrating Concurrency and Synchronization
    Mutexes, atomics, thread pools, and a concurrent file indexer (zlocate)

  • Chapter 9 — Implementing Asynchronous I/O
    Zig 0.16 async/await, io_uring, and asynchronous TCP proxy

  • Chapter 10 — Building a High-Performance In-Memory Cache Server
    zcache with LRU, custom binary protocol (ZEMP), and thread-per-connection model

  • Chapter 11 — Persisting Structured Data with SQLite3
    Full note-taking service with HTTP API and comptime SQL generation

  • Chapter 12 — Developing a Domain Specific Language
    Building zcalc — a small interpreted language with lexer, parser, evaluator, and REPL

Where to Buy Link to heading

Source Code Link to heading

All code examples are available on GitHub and organized by chapter:

https://github.com/mactsouk/zigSP

The code is written for Zig 0.16 and tested on macOS and Linux.


I hope you enjoy the book! If you read it, I would greatly appreciate your honest feedback and any review you can leave on Amazon.

Happy coding with Zig!