When multiple threads share data, their operations can interleave in the middle of a multi-step update, producing a race condition — a bug where the outcome depends on unpredictable timing. Synchronization is the set of tools that force safe ordering.
The problem: a race condition
count++ looks atomic but is really read-modify-write:
