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.

    11 min read 2,106 words Category: HPC Tags: lock free, atomics, memory ordering

  • 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.

    11 min read 2,004 words Category: HPC Tags: pthreads, false sharing, atomics