Systems and low latency
A producer writes data then sets a flag; a consumer reads the flag then the data.
ExpertMultiple choice
A producer writes data then sets a flag; a consumer reads the flag then the data. What is the weakest memory ordering that suffices?
- ARelease on the store to the flag, acquire on the load
- BRelaxed on both, since the flag is atomic
- CSequential consistency on both, since nothing weaker is safe
- DA mutex, since atomics cannot order other memory
The worked solution is in Premium
The answer, the full working and the one idea to take away – for this and all 1,322 questions in the bank. Answer it in practice and your working is marked, with a known mistake named when you make one.
Report an issue with this question
Learn the method
Of the kind reported at
More systems and low latency questions
- Messages arrive at 400,000 a second and take 2 μs each to process on one thread.Advanced · Premium
- What synchronisation does a single-producer, single-consumer ring buffer need…Advanced · Premium
- Per-thread counters, part 3 of 3Advanced · Premium
- A ring buffer has capacity 1024 and wraps its index with a bit mask instead of a modulo.Foundation · Premium
- Per-thread counters, part 1 of 3Foundation · Premium
- Five per cent of a workload is inherently serial.Applied · Premium