Template:cpp/atomic/relaxed

Atomic operations tagged are not synchronization operations; they do not impose an order among concurrent memory accesses. They only guarantee atomicity and modification order consistency.

For example, with and  initially zero,

is allowed to produce because, although A is sequenced-before B within thread 1 and C is sequenced before D within thread 2, nothing prevents D from appearing before A in the modification order of y, and B from appearing before C in the modification order of x. The side-effect of D on y could be visible to the load A in thread 1  while the side effect of B on x could be visible to the load C in thread 2. In particular, this may occur if D is completed before C in thread 2, either due to compiler reordering or at runtime.

Typical use for relaxed memory ordering is incrementing counters, such as the reference counters, since this only requires atomicity, but not ordering or synchronization