← All pins

Pins tagged “concurrency”

The when, why and how of waiting and backoff in multi-threaded applications on Arm

An Arm post on what a thread should do while it waits, whether on a lock or after a failed atomic. Spinning in a tight loop is the obvious move, but it floods memory with traffic and slows every other core touching the same location, so backing off helps both throughput and fairness. The post covers backoff strategies that space out the checks, and the Arm specific tools for them: the counter timer for timed waits, the WFET instruction on Armv8.7 and later that lets a core sleep for a set duration instead of burning power, and barriers like ISB and SB that control how far ahead the processor looks. It also lists patterns that look correct but are not, such as empty loops and simple LDXR plus WFE combinations, and explains why they fall apart as thread counts grow.

armperformanceconcurrency

Memory Barriers: a Hardware View for Software Hackers

Paul McKenney's paper on why memory barriers exist at all, built from the hardware up. It starts with how a CPU cache is laid out, then how the MESI protocol keeps caches agreeing on the value of each location, then how store buffers and invalidate queues quietly break that agreement in exchange for speed. Once you see those two queues, read and write barriers stop looking arbitrary and start looking like the obvious fix.

memoryconcurrencyhardwarepapers