Quick Contact

✉
fahimkhan20148@gmail.com
📱
+971 507 286 133
Back to Notes
August 18, 2026
rustconcurrencyatomics

Atomics in Rust

The word atomic comes from the Greek word ἄτομος, meaning an indivisible item that can't be cut into further smaller parts.

Atomic operations are the smallest operations on data that either occur or do not; there is no half-done state. Two threads can update an atomic variable without creating an inconsistent state where both reads return the same value and update it at the same time.

The implementation of atomics and which types are available depends on the system architecture and OS.

Two threads can update an AtomicI32 without creating an inconsistent state in which both reads return the same value and update it at the same time.

The implementation of atomics and which ones are available depends on the system architecture and OS.

Unlike other types, we don't have an Atomic<T>; we only get AtomicBool, AtomicI32, etc., up to the word size, i.e., AtomicUsize.