All posts

performance

7 posts
THREADING

Spinlocks, Mutexes, and Futexes: Picking the Right Lock

Three primitives cover almost every locking decision: spinlocks, mutexes, and futexes. They solve the same problem with very different cost models — burning CPU vs trapping to the kernel vs the hybrid approach modern mutexes actually use.

NETWORKING

Bypassing the Kernel: How DPDK Hits 10 Million Packets per Second

The Linux network stack tops out at ~2 Mpps per core. DPDK reaches 20 Mpps. The difference isn't speed — it's removing work: no syscalls, no allocations, no demux, no locks. Why kernel-bypass exists and when it earns its complexity.

SYSTEMS

Memory Barriers Demystified: Acquire, Release, and Why They Matter

Compilers reorder. CPUs reorder. Single-threaded code never notices — multi-threaded code crashes mysteriously. A clear walk through acquire and release semantics, what the hardware actually does, and the spinlock that ties it all together.

NETWORKING

How epoll Actually Works: Inside the Kernel's Event Loop

select and poll were O(n). epoll is O(1). The reason isn't smarter scanning — it's that the kernel pushes ready events into a list as they happen. A walk through the data structures that make it work.