જ્યારે અનેક threads data વહેંચે છે, ત્યારે તેમની operations એક multi-step update ની વચ્ચે interleave થઈ શકે છે, જે એક race condition પેદા કરે છે — એવો bug જ્યાં પરિણામ અણધાર્યા timing પર આધાર રાખે છે. Synchronization એ સાધનોનો સમૂહ છે જે સલામત ordering લાગુ કરે છે.
સમસ્યા: એક race condition
count++ atomic લાગે છે પણ ખરેખર read-modify-write છે:
