Threads share memory, and the scheduler can switch between them after any single instruction. count++ is three instructions (load, add, store), so two threads can both read the old value and one increment vanishes. Step through one interleaving, then see where every interleaving ends.