Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

data race

Two threads touching the same memory at the same time, at least one of them writing, with nothing to order them. In C++ that is undefined behaviour.

In C++ a data race is two conflicting accesses (same location, at least one a write) from different threads, not both atomic, with neither happening before the other; a program containing one has undefined behaviour.

Examples

  • Two threads each running count++ 1,000 times on a plain int can end with less than 2,000.

Read the full section →