liveBook · Manning

Atom

An atom is a Clojure reference type that supports synchronous, independent, coordinated updates to shared state without explicit locks.

How 2 Manning books explain it

Data-Oriented Programming: Reduce software complexity

An atom is a concurrency-control mechanism that provides coordinated updates to shared state without requiring explicit locks.

How it is used
Manages shared counters, caches, and complete system state in multithreaded environments without explicit locks.
How deep it goes
Explains get, set, swap, immutable reads, and compare-and-set retries, while deferring detailed starvation analysis.
Examples
Uses a database-access counter, an immutable string-map cache, and reconciled system state as progressive examples.
What you can do after
Apply it via get, set, and swap to build thread-safe state updates without lock-related deadlocks.

Read how Data-Oriented Programming: Reduce software complexity explains atom →

Clojure: The Essential Reference

clojure.lang.Atom is the Clojure runtime class that wraps a Java AtomicReference to implement atom state management.

How it is used
Coordinates synchronous, uncoordinated access to a single shared state reference without explicit locking.
How deep it goes
Defines retrying updates, reset semantics, CAS behavior, dereferencing, and the AtomicReference wrapper through executable examples.
Examples
Uses counters, nested maps, configuration state, bounded CAS retries, and memoization caches.
What you can do after
Apply atom, swap!, reset!, compare-and-set!, and dereferencing to manage shared state.

Read how Clojure: The Essential Reference explains atom →

What to know first

Related concepts

Questions about atom

What is atom?

An atom is a Clojure reference type that supports synchronous, independent, coordinated updates to shared state without explicit locks.

Which Manning books explain atom?

Data-Oriented Programming: Reduce software complexity and Clojure: The Essential Reference.

What should I know before learning atom?

Manning books that teach atom usually introduce compare-and-swap and critical section first.

What is the difference between atom and delay??

An atom is a Clojure reference type that supports synchronous, independent, coordinated updates to shared state without explicit locks. delay? is a Clojure function that tests whether a value is a delay object.

What is atom a kind of?

Atom is a kind of concurrency primitive. A concurrency primitive is a fundamental language or runtime mechanism for coordinating concurrent execution or controlling access to shared state or resources.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.