Atomics
Posts with this tag
Posts
-
Lock-Free Queues and Memory Ordering: An SPSC Ring Buffer Measured Against a Mutex
A single-producer single-consumer ring buffer in C11 atomics, the happens-before argument that makes acquire/release enough, ABA and MPMC caveats, and a measured comparison with pthread_mutex queues.
-
Threads, Reductions and False Sharing: Five Ways to Add Up Numbers in Parallel
A pthreads reduction measured five ways on an eight-core laptop: one shared atomic, packed per-thread counters, padded per-thread counters, register accumulators, and dynamic chunking, with a short primer on the C11 memory model that makes the fast version correct.