IT lexicon › Programming › Relaxed memory model

Relaxed memory model

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

Memory model that offers no guarantees about the order in which memory operations become visible across threads.

Under a relaxed-memory model, there is no guarantee that writes and reads from different threads appear in the same order everywhere. Each processor buffers its own memory, reorders instructions for speed, and optimizes aggressively—only promising that everything eventually becomes consistent. ARM, PowerPC, and modern x86 all use relaxed memory internally; x86 masks most of the complexity behind an almost-sequential facade.

Programmers writing lock-free code must manually insert memory barriers to enforce ordering. Without them, a read of a flag can race with a write to the data that flag protects—both from the same thread, just in the wrong order. Relaxed memory is faster on many-core processors but far more dangerous without discipline.

← Back to the lexicon