An atomic operation completes indivisibly — no other thread sees a half-done state; memory visibility is whether one thread's writes are seen by another; memory barriers enforce ordering so those writes become visible. Locks are not the only concern — the memory model is.
Atomicity
An atomic op (e.g. fetch_add, compare-and-swap) executes as one indivisible step, so no race splits it. Hardware and language provide atomics for counters and flags without a full lock.
();
counter.incrementAndGet();
