A **race condition** is when the **behavior or outcome of a program depends on the timing or order of [[Threads vs. Processes|threads]]** — and this leads to **unpredictable or incorrect results**.
---
---
#### Prevention via Locks
Most multithreading libraries use so-called locks, which have to be aquired by threads to access critical sections.