Articles

Deep dives into systems programming.

Local Caching Policies and Mechanisms: An Algorithmic Guide

This guide describes the algorithms behind local (in-process / single-node) caching systems in enough detail that each can be implemented from the description alone.

Releasing & Distributing Zig Projects

A complete reference for tagging, GitHub releases, and distributing Zig libraries and CLI tools across npm, Homebrew, AUR, apt, and Windows package managers.

Text Editor Data Structures: Gap Buffers, Ropes, and Piece Tables

A deep dive into how the editors you use every day actually store and manipulate text — and why it's one of the most underrated problems in systems programming.

Append-Only Logs: The Storage Pattern Behind Databases and Durable Systems

Append-only logs are simple, fast, and crash-friendly. Learn record formats, checksums, compaction, and how WAL-like designs work, with C, Zig, and Rust examples.

Reactor vs Proactor: Event Loops, Async I/O, and How Servers Scale

Reactor (readiness) and proactor (completion) are two mental models for scalable I/O. Learn how epoll and io_uring fit, and implement tiny examples in C, Zig, and Rust.

Memory Debugging: AddressSanitizer, Valgrind, and Practical Triage

A practical guide to debugging memory issues: use-after-free, buffer overflows, leaks, and data races. Learn what tools catch, what they miss, and how to reproduce issues with C, Zig, and Rust.

Concurrent File Processing Pipelines: Batching, Backpressure, and Work Partitioning

Build a practical pipeline to process many files concurrently without overwhelming the system. Learn batching, bounded queues, and work partitioning with C, Zig, and Rust examples.

The Page Cache and Writeback: Why Disk I/O Doesn't Behave Like You Think

Understand Linux page cache, buffered I/O, dirty pages, writeback, and how fsync interacts with durability. Includes experiments and code in C, Zig, and Rust.

Atomic File Save Patterns: temp files, write barriers, and avoiding torn writes

Practical patterns for safely updating configuration and state files. Covers temp+rename, write-ahead logs, checksums, and length-prefix formats with C, Zig, and Rust examples.

Crash Consistency: fsync(), rename(), and Durable Writes You Can Trust

Power loss and crashes turn "it worked" into "it corrupted". Learn what fsync guarantees, why rename is special, and how to implement crash-consistent updates in C, Zig, and Rust.

Futexes and Parking: How Fast Locks Sleep Without Syscalls

Futexes are the kernel primitive behind fast mutexes and condition variables on Linux. Learn the "fast path" vs "slow path", and build a tiny mutex using C, Zig, and Rust.

Advanced mmap: madvise(), mincore(), and Page-Fault Aware Performance

Go beyond basic mmap. Learn how to hint access patterns with madvise, check residency with mincore, and design page-fault friendly readers in C, Zig, and Rust.

Message Passing and Channels: Concurrency Without Shared Mutable State

Learn message-passing concurrency: bounded vs unbounded channels, backpressure, fan-in/fan-out, and shutdown semantics. Includes C, Zig, and Rust examples and practical patterns.

Thread Pools and Backpressure: Scaling Work Without Melting Down

Thread pools are easy to create and hard to run safely. Learn bounded queues, backpressure, shutdown, and avoiding unbounded memory growth, with C, Zig, and Rust examples.

File Locking on Unix: flock() vs fcntl() and What They Actually Guarantee

File locking is deceptively subtle. Learn advisory locks, flock vs fcntl record locks, lease-like patterns, and how to implement a safe "single instance" lockfile in C, Zig, and Rust.

File Descriptors Deep Dive: open flags, offsets, CLOEXEC, and dup()

File descriptors are the universal I/O handle on Unix. Learn how fd state works (offsets, flags), how dup/dup2 behave, why CLOEXEC matters, and how to build robust patterns in C, Zig, and Rust.

Async I/O on Linux with io_uring: A Practical Overview

io_uring moves beyond readiness: submit I/O and receive completions. Learn the core concepts, when it helps, and minimal examples in C, Zig, and Rust.

I/O Multiplexing: select(), poll(), and epoll() Explained

How do servers handle thousands of connections? Learn readiness-based I/O with select/poll/epoll, common edge cases, and build a tiny event loop in C, Zig, and Rust.

Filesystems 101: Inodes, Directories, and What a Path Lookup Really Does

Understand the core filesystem abstractions: inodes, dentries, hard links, symlinks, and why path lookup can be expensive. Includes practical code in C, Zig, and Rust.

mmap vs read/write: Choosing the Right File Access Strategy

When should you use mmap, and when are classic read/write loops better? Learn page cache behavior, page faults, random access, and safe patterns in C, Zig, and Rust.

Lock-Free SPSC Ring Buffer: A High-Throughput Queue Between Two Threads

Build a correct single-producer single-consumer ring buffer using atomics, and understand why SPSC is simpler than MPMC. Includes C, Zig, and Rust implementations.

Threads and Synchronization: Mutexes, Condition Variables, and Semaphores

A detailed, practical guide to concurrency primitives: what mutexes guarantee, how condition variables work, and how to structure correct waiting loops — with C, Zig, and Rust examples.

Atomics and Memory Ordering: Building Correct Lock-Free Code

A practical guide to atomic operations and memory ordering (relaxed/acquire/release/seq_cst). Learn what the CPU and compiler are allowed to do, with C, Zig, and Rust examples.

File I/O Fundamentals: read/write, Buffers, and the Cost of Syscalls

Learn the practical mechanics of file I/O: file descriptors, syscalls, buffering, partial reads/writes, and robust patterns with C, Zig, and Rust.

Cache Locality and Data Layout: Turning Memory Into Throughput

CPU caches reward predictable access. Learn spatial/temporal locality, AoS vs SoA, prefetching, and how to measure improvements in C, Zig, and Rust.

Virtual Memory Foundations: Address Spaces, Paging, and Protection

A detailed, practical walkthrough of virtual memory: pages, page tables, permissions, and what happens during a page fault — with C, Zig, and Rust examples.

Building a Memory Allocator from Scratch in C

Learn how memory allocation works by implementing your own malloc() and free() functions in C. A deep dive into heap management, fragmentation, and optimization techniques.

Welcome to 0xKiire - Exploring the Depths of Systems Programming

Welcome to 0xKiire, a blog dedicated to low-level programming, systems design, and performance optimization. Join me as we explore the fascinating world beneath the abstractions.