About this interactive
What you are doing: working out what a race condition left behind, as a number.
A race condition happens when more than one task uses the same value at once, or when a value changes between the time it is checked and the time it is used. Lesson pshk-10-0040 shows both, and each leaves a result you can calculate.
Lost update. Two tasks read the same value, each changes its own copy, and each writes its copy back. The last write wins, and the other task's change disappears. A score of 70 read by two tasks, one adding 10 and one adding 20, ends at 80 or 90, never the 100 it should.
Check, then use. A value is checked, and only later used or updated. Every check that runs in between sees the same old value, so each one is approved. Two requests for $70 against a $100 balance both pass their check and leave −$40.
The window. The time from the check to the use is the time-of-check to time-of-use (TOCTOU) window. It is the use time minus the check time, and anything that delays the use, a pause, a slow call, a session that stays signed in, makes it longer.
For each case, ask which value each task read, which write lands last, and what was checked before anything was recorded.
About TechKnowSurge
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →