Tags

#Lock-Free

5 posts

Hands-on Practice #18 16 min read

Thread-Safe Queues

From one mutex to many producers: condition variables and lost wakeups in a blocking queue, rte_ring’s two pairs of indices and in-order publishing, Disruptor’s availability flags, and whether a full queue should block, drop, or …

Low-Latency Systems Development #17 14 min read

Wait-Free

Wait-free is not a faster lock-free: it turns a failed CAS from “try again” into “I come after you”, which bounds every thread’s steps, at the cost of more atomics and code that is harder to get right.

Low-Latency Systems Development #14 10 min read

Prefetching, Cache Warming, and Double Buffering

There are three ways to get data into cache ahead of time, each with a precondition: prefetching needs you to know the address before the hardware does, warming has to happen on the core that reads the data, and double buffering …

Low-Latency Systems Development #5 22 min read

An SPMC Broadcast Ring in Shared Memory

Market data has one producer and several consumers, each of which must see every message, and the producer is the hot path that may not wait for anyone. The answer is a broadcast ring: every slot carries its own sequence stamp, …

Low-Latency Systems Development #4 24 min read

Lock-Free Queues and Micro-Batching

A lock-free SPSC queue works because every shared variable has exactly one writer: each side updates only its own counter and merely reads the other’s. The rest is keeping that property from being quietly undone — a shared element …