Computer Science

Race Condition, explained

A race condition occurs when program behavior depends on unpredictable timing between concurrent operations.
Back to Glossary

Part of the Semantic Notion technical glossary.

Short Definition

A race condition occurs when program behavior depends on unpredictable timing between concurrent operations.

Intuition

Two tasks race to read or write shared state, and the final result changes depending on who gets there first.

Technical Definition

A race condition is a correctness bug caused by unsafely ordered access to shared state or resources in concurrent execution.

Example

Two withdrawals processed at the same time may both read the same account balance and overdraw the account.

Common Misunderstandings

Race conditions can appear even if failures are rare.
Testing may miss races because timing is nondeterministic.

Start here

Need the broader concept map?

Return to the glossary index to move from this definition into adjacent AI, ML, mathematics, and computer science terms.