What a data race is
A data race happens when two threads access the same memory location, at least one access is a write, and nothing orders the two accesses. The result is undefined and often appears only rarely.
How detection works
A dynamic race detector watches a single real execution and records, for each memory location:
- which threads read or wrote it
- what synchronization happened around each access
If it finds two accesses with no ordering between them and one is a write, it reports a race.
Why it misses some bugs
A detector that watches one run only sees the schedule that actually happened. A race on a path that never executed stays hidden, so detection finds bugs but cannot prove their absence.
Key idea
A data race is an unordered conflicting access, and a dynamic detector reports one only when the racing pair actually runs during the observed execution.