← InterviewAdvanced
Race Condition or Data Race?
What is the difference between a race condition and a data race? Can you have one without the other?
The scenario
A code review flags an unsynchronized
bool ready written by one thread and read by another in a C++ service. The author replies that both values are valid so the race is benign.What it tests
- Whether the candidate knows these are different concepts rather than synonyms
- Whether they can place a data race inside a language memory model
- Whether they can construct each one without the other
Answer it out loud first. Recognising a good answer is not the same skill as producing one.