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)andwhich(1)clones + direct C interoperability with@cImport() -
Chapter 2 — Systems Infrastructure: Builds, Testing and Distribution
Masteringbuild.zig, allocators, testing, and publishing Zig packages -
Chapter 3 — Direct Memory Access and Binary Formats
Pointer arithmetic, custom allocators, endianness, and azunziputility -
Chapter 4 — Processing Streams, Buffers and Data Encoding
High-performance I/O withzcat,zwc,z64, buffering, and SIMD -
Chapter 5 — Navigating Directories and Filesystem Events
ztreeandzwatch(usinginotify/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 minimalcron-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
zcachewith LRU, custom binary protocol (ZEMP), and thread-per-connection model -
Chapter 11 — Persisting Structured Data with SQLite3
Full note-taking service with HTTP API andcomptimeSQL generation -
Chapter 12 — Developing a Domain Specific Language
Buildingzcalc— a small interpreted language with lexer, parser, evaluator, and REPL
Where to Buy Link to heading
-
Packt Publishing (official page):
https://www.packtpub.com/en-us/product/systems-programming-with-zig-9781807426422 -
Amazon.com:
https://www.amazon.com/dp/1807426432/ -
Amazon.co.uk:
https://www.amazon.co.uk/dp/1807426432/
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!