All challenges
Multiple ChoiceHard 45s

relaxed atomic does not synchronize

Two threads use `memory_order_relaxed` on an atomic flag to publish a non-atomic buffer. What is wrong?
Options
  1. 1Nothing is wrong; relaxed ordering still synchronizes the related non-atomic data correctly.
  2. 2It is a compile error to combine a relaxed atomic with access to ordinary non-atomic data.
  3. 3Relaxed provides no happens-before/synchronizes-with, so the reader may see the flag set but stale buffer contents — a data race.
  4. 4Relaxed ordering is actually stronger than acquire/release, so the code is entirely fine.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle