Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Systems Programming with Zig
  • Table Of Contents Toc
Systems Programming with Zig

Systems Programming with Zig

By : Mihalis Tsoukalos
close
close
Systems Programming with Zig

Systems Programming with Zig

By: Mihalis Tsoukalos

Overview of this book

Build reliable systems software with Zig through a project-driven approach focused on practical engineering challenges. Guided by UNIX systems engineer & bestselling author Mihalis Tsoukalos, you will learn modern systems programming techniques while creating production-ready applications, UNIX tools, & network services. This book takes you from essential UNIX tooling and build infrastructure to advanced topics such as direct memory access, binary formats, filesystem monitoring, networking, concurrency, asynchronous I/O, & database integration. Through hands-on projects, you will create command-line utilities, TCP and UDP services, HTTP applications, file indexing tools, cache servers, & a domain-specific language interpreter that combines memory management, comptime metaprogramming, parsing, evaluation, & error handling. Each chapter demonstrates how Zig features solve practical systems programming problems. You will work with memory management, process control, synchronization primitives, event-driven architectures, SQLite integration, protocol design, & performance-focused data structures while learning the reasoning behind key engineering decisions. By the end of this book, you will be able to build efficient and maintainable systems software in Zig & confidently apply the language to production projects.
Table of Contents (18 chapters)
close
close
Lock Free Chapter
1
Part 1: Zig Foundations
6
Part 2: Systems Programming in Practice
17
Index

Developing zcache

Zcache is a high-performance in-memory cache server written in Zig, designed around three cleanly separated layers. At its core sits the storage engine, which implements an LRU cache by combining a hash map and a doubly linked list — the hash map provides O(1) key lookup while the linked list maintains access order, keeping every get, set, and eviction O(1) regardless of cache size. Time-to-live (TTL) expiry is handled lazily: rather than running a background sweep thread, entries are checked and evicted on the first access after their lifetime elapses, keeping the hot path simple and latency predictable. On top of the storage engine sits ZEMP (Zcache Exchange Message Protocol), a custom binary wire protocol where every message begins with a fixed 8-byte prefix containing a magic byte, version, command type, and payload length. That fixed-width prefix is the key design decision: the parser always knows exactly how many bytes to read next without scanning for...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Systems Programming with Zig
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon