IT lexicon › Programming › Fetch-and-add

Fetch-and-add

Programming På svenska → Updated: 2026-11-15

An atomic processor instruction that reads a memory word, adds a value to it, and writes the result back, all in one indivisible step.

Fetch-and-add (FAA) is the classical alternative to compare-and-swap for building atomic counters and lock-free algorithms. On modern CPUs it's often faster than CAS and easier to reason about for specific use cases. Nearly every CPU architecture has supported it since the 1980s.

The key difference from CAS is that FAA always succeeds — there's no retry loop. This makes it less flexible (you can't express conditional logic), but much more deterministic for counters, queues, and purely additive operations. Many lock-free queue implementations use FAA for head and tail pointers because the simplicity pays off in throughput.

← Back to the lexicon