Labs / Computer Science

Race Condition Lab

Two threads each try to add 1 to the same counter, over and over. But “add 1” is really three steps — read, increment, write — and when those steps interleave, an update can quietly disappear. Turn on the mutex to fix it, or switch to Manual and click a thread to schedule the steps yourself.

Labs / Computer Science / Race Condition Lab

Computer Science20–30 minFoundation

Race Condition Lab

Two threads each try to add 1 to the same counter, over and over. But “add 1” is really three steps — read, increment, write — and when those steps interleave, an update can quietly disappear. Turn on the mutex to fix it, or switch to Manual and click a thread to schedule the steps yourself.

Why it matters

Why explore this?

Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.