All challenges
Multiple ChoiceBeginner 45s

release-acquire pairing guarantee

A writer does: data = 42; flag.store(true, std::memory_order_release); A reader spins on flag.load(std::memory_order_acquire) then reads data. What is guaranteed?
Options
  1. 1data may still read as 0 due to reordering
  2. 2The compiler inserts a full fence making it volatile
  3. 3This is undefined because data is not atomic
  4. 4The reader sees data == 42 with no data race on data

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