All challenges
Multiple ChoiceBeginner 45s

memory_order_relaxed visibility

A thread runs a.store(1,relaxed); b.store(1,relaxed). Another thread observes b.load(relaxed)==1 then reads a. Which is guaranteed?
Options
  1. 1The reader is guaranteed to observe a==1
  2. 2The stores and loads are sequentially consistent
  3. 3No ordering is guaranteed; the reader may observe a==0
  4. 4The program has undefined behavior

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