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 →

Related concepts

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.