IT lexicon › Programming › Atomic flag

Atomic flag

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

A single-bit atomic operation that is often implemented more efficiently than general atomic variables and is ideal for simple boolean flags.

An atomic flag is the smallest atomic unit: a single boolean that can be read, written, or test-and-set atomically. Most processor architectures can implement this without a full lock mechanism—often a single processor-level atomic guarantee suffices. Many concurrency libraries (C++, Java, Rust) provide dedicated implementations that are faster than a generic atomic<bool>.

Atomic flags are commonly used as simple synchronization points between threads: signaling shutdown, marking completion, or as building blocks in more complex lock-free structures.

← Back to the lexicon