atomic operation અવિભાજ્ય રીતે પૂરું થાય છે — કોઈ બીજો thread અડધું-થયેલું state જોતું નથી; memory visibility એ છે કે એક thread ના writes બીજા દ્વારા જોવાય છે કે નહીં; memory barriers ordering લાગુ કરે છે જેથી તે writes visible બને. Locks એકમાત્ર ચિંતા નથી — memory model છે.
Atomicity
atomic op (દા.ત. fetch_add, compare-and-swap) એક અવિભાજ્ય step તરીકે execute થાય છે, તેથી કોઈ race તેને વિભાજિત કરતું નથી. Hardware અને language counters અને flags માટે full lock વગર atomics પૂરાં પાડે છે.
();
counter.incrementAndGet();
