Atomicity
Atomicity is the property that an operation or group of operations takes effect as an indivisible whole, without observable partial effects.
GPU Programming with Triton
An atomic operation performs a memory read-modify-write update as one indivisible transaction that cannot be interleaved at the target address.
- How it is used
- Uses atomic updates to combine contributions from GPU program instances at shared destinations.
- How deep it goes
- Explains read-modify-write execution at L2, contention, local aggregation, and floating-point ordering effects.
- Examples
- Demonstrates a one-pass global sum and contrasts it with a two-pass reduction.
- What you can do after
- Apply it via Triton's tl.atomic_add to combine per-instance partial sums.
Learn Concurrent Programming with Go
An atomic operation is an indivisible operation that cannot be interrupted during its execution.
- How it is used
- Protects concurrent reads and updates of a shared single variable from race conditions.
- How deep it goes
- Defines indivisible operations, traces a race, and demonstrates Go atomic updates, while deferring multi-variable protection to mutexes.
- Examples
- Uses a shared bank balance, a concurrent letter-frequency counter, and multi-flight booking to contrast suitable and unsuitable cases.
- What you can do after
- Apply it via Go's sync/atomic package for single-variable additions, loads, stores, swaps, and compare-and-swap operations.
Read how Learn Concurrent Programming with Go explains atomicity →
API Design Patterns
Atomicity is the property of treating a multi-step operation as an indivisible unit whose effects are either all applied or all undone.
- How it is used
- Uses all-or-nothing semantics to keep multi-resource API changes, list updates, and data copies consistent.
- How deep it goes
- Defines indivisibility and applies it to lists, batch methods, singleton sub-resources, and copy consistency, without specifying a universal transaction protocol.
- Examples
- Demonstrates whole-list replacement, BatchGetMessages failures, ChatRoom logging configuration, and point-in-time resource copying.
- What you can do after
- Build API operations that either apply all intended effects or return one complete failure, while documenting unavoidable consistency limits.
Think Distributed Systems
Failure atomicity is the property that an operation either completes as an indivisible unit or exposes no partial effect when execution fails.
- How it is used
- Uses atomicity to reason about transactions, crashes, partial executions, and coordinated decisions across distributed components.
- How deep it goes
- Defines all-or-nothing behavior, models crash prefixes, distinguishes concurrency from failure atomicity, and specifies distributed safety and liveness.
- Examples
- Uses signup payment, one-resource money transfer, two-resource money transfer, and process traces that crash after zero or more steps.
- What you can do after
- Evaluate whether operations expose partial effects and reason about commit or abort guarantees under crashes and distributed coordination.
Latency
Atomicity is the transaction property that requires all of a transaction's operations to take effect or none of them to take effect.
- How it is used
- Defines the all-or-nothing guarantee used in safe database transactions.
- How deep it goes
- Defines transaction atomicity as an ACID property without detailing its implementation; explains atomic memory operations separately.
- Examples
- Illustrates indivisible memory operations with an atomic-flag spinlock, rather than a transaction example.
- What you can do after
- Evaluate and understand transaction atomicity alongside other ACID guarantees and their performance trade-offs.
100 SQL Server Mistakes and How to Avoid Them
Atomicity is the transaction property that makes all of a transaction's operations succeed or fail as one unit.
- How it is used
- Uses atomicity to keep multi-statement database updates together when stored procedures or queries succeed or fail.
- How deep it goes
- Defines all-or-nothing behavior, demonstrates open-transaction failures, and defers broader transaction nuances to isolation and durability.
- Examples
- Demonstrates sales-order insertion, invalid tables, foreign-key violations, @@TRANCOUNT checks, and TRY...CATCH procedures.
- What you can do after
- Diagnose unfinished transactions with @@TRANCOUNT and implement rollback-aware TRY...CATCH handling around multi-statement updates.
Read how 100 SQL Server Mistakes and How to Avoid Them explains atomicity →
100 Java Mistakes and How to Avoid Them
An atomic request is an operation that observes or updates its target as one indivisible action without an intervening state change.
- How it is used
- Prevents check-then-act errors when filesystem state, time, weak references, or shared collections can change between requests.
- How deep it goes
- Explains concrete races and replaces split calls with bounded reads, Queue.poll, ConcurrentMap methods, and AtomicInteger.updateAndGet.
- Examples
- Contrasts file-size checks with bounded stream reads, isEmpty-plus-remove with poll, map counting with merge, and get-set with updateAndGet.
- What you can do after
- Apply it via Java filesystem, Queue, ConcurrentMap, and AtomicInteger APIs to avoid races caused by split observations and updates.
Read how 100 Java Mistakes and How to Avoid Them explains atomicity →
MongoDB 8.0 in Action, Third Edition
Atomicity is a transaction property in which an operation completes entirely or has no effect.
- How it is used
- Preserves database integrity by preventing partial single-document operations and coordinating changes that must succeed together.
- How deep it goes
- Explains single-document behavior, multidocument scope, WiredTiger storage, and optimistic conflict handling, but not recovery implementation in detail.
- Examples
- Uses travel booking, single-document failure, and a Node.js account-and-customer transaction to demonstrate all-or-nothing behavior.
- What you can do after
- Apply it via MongoDB single-document operations or the Node.js withTransaction Callback API to coordinate reliable updates.
Read how MongoDB 8.0 in Action, Third Edition explains atomicity →
Functional Design and Architecture: Examples in Haskell
Atomicity is the property that a transaction's operations take effect as one indivisible unit.
- How it is used
- Uses atomicity to make shared-state transactions thread-safe in concurrent application logic.
- How deep it goes
- Explains atomic transactions, composition, rollback through retry, and execution with atomically, but leaves subtle usage concerns largely undeveloped.
- Examples
- Demonstrates atomicity with TQueues, meteor reporting, transaction composition, and the dining philosophers problem.
- What you can do after
- Apply it via Haskell’s STM library to build, compose, retry, and atomically execute thread-safe state updates.
Read how Functional Design and Architecture: Examples in Haskell explains atomicity →
Grokking Software Architecture
A transaction property requiring its operations to succeed or fail as a single indivisible unit.
- How it is used
- Protects relational database changes by making transactions succeed or fail as one unit, and motivates safer event publication.
- How deep it goes
- Defines all-or-nothing behavior with a purchase example and flags dual-write failure, while deferring the outbox pattern.
- Examples
- Uses a last-pair sneaker purchase and an order-save versus event-publish failure to illustrate atomicity risks.
- What you can do after
- Understand why partial database updates must be rolled back and why publishing an event alongside a database write poses a separate risk.
Read how Grokking Software Architecture explains atomicity →
Designing AI Systems
Atomicity is the database transaction property that requires all operations in a transaction to succeed together or none to take effect.
- How it is used
- Protects session writes, document replacement, and cascading deletion from leaving partial or inconsistent data.
- How deep it goes
- Explains transaction boundaries, commit behavior, rollback consequences, and cross-artifact consistency without detailing database isolation levels.
- Examples
- Uses batched message insertion, document re-ingestion, and deletion across document records, chunks, and vectors.
- What you can do after
- Designs and implements multi-step persistence operations that commit completely or roll back after failure.
Microservices Patterns, Second Edition
Atomicity is the transaction property that all operations succeed as one unit or the transaction has no effect.
- How it is used
- Prevents system commands from leaving partial effects by making their transaction succeed or fail as a whole.
- How deep it goes
- Explains the all-or-nothing guarantee and its role in commands, with transaction examples but little implementation detail.
- Examples
- Groups a product lookup, credit deduction, and order insertion within one transaction.
- What you can do after
- Apply atomicity through local ACID transactions to prevent system commands from leaving partial effects.
Read how Microservices Patterns, Second Edition explains atomicity →
Crack Any Codebase with AI
Atomicity is the property that a transaction's operations either all take effect or none take effect.
- How it is used
- Uses atomicity to locate failure boundaries in multi-step workflows and distinguish database consistency from real-world consistency.
- How deep it goes
- Traces transaction scope, crash windows, and retry behavior, stopping short of treating external network calls as transactionally protected.
- Examples
- Examines booking cancellation, status and audit writes, Stripe refunds, reminder cancellation, webhooks, and Google Calendar deletion.
- What you can do after
- Diagnose partial failures, identify unsafe retry points, and demand idempotency keys for repeatable external effects.
100 Go Mistakes and How to Avoid Them
An atomic operation is an indivisible operation that cannot be interrupted by competing accesses to the same data.
- How it is used
- Prevents data races during concurrent updates by making a shared operation indivisible.
- How deep it goes
- Explains interleaved increments, demonstrates sync/atomic, and contrasts mutexes and channels; it omits atomic.Value.
- Examples
- Uses competing i++ operations, an atomic int64 increment, a mutex-protected increment, and channel-based increment notifications.
- What you can do after
- Apply it via sync/atomic to make supported numeric updates deterministic across goroutines.
Read how 100 Go Mistakes and How to Avoid Them explains atomicity →
Advanced Algorithms and Data Structures
An atomic operation is an operation that appears indivisible to concurrent observers, with no visible intermediate state.
- How it is used
- Prevents race conditions while mutable cache methods execute concurrently.
- How deep it goes
- Explains intermediate-state interference, lock-based isolation, lock scope, and deadlock risk without developing synchronization comprehensively.
- Examples
- Uses an LFU cache set operation, competing threads with one free slot, synchronized cache locking, and Java concurrent collections.
- What you can do after
- Build it from scratch by enclosing dependent cache mutations in a write lock and releasing it reliably.
Read how Advanced Algorithms and Data Structures explains atomicity →
Data Pipelines with Apache Airflow, Second Edition
An atomic transaction is an indivisible database transaction whose operations either all take effect or have no effect.
- How it is used
- Designs Airflow tasks that report accurate outcomes during retries, failures, backfills, and reruns.
- How deep it goes
- Defines all-or-nothing behavior, demonstrates task decomposition, and applies transactions without detailing database isolation internals.
- Examples
- Uses user statistics and email delivery, API authentication, and pandas database replacement as concrete cases.
- What you can do after
- Apply it via Airflow by separating independent work and wrapping related database changes in transactions.
Read how Data Pipelines with Apache Airflow, Second Edition explains atomicity →
Spring Start Here, Second Edition
Atomicity is the transaction property that requires all operations in a transaction to succeed together or for none of their changes to take effect.
- How it is used
- Protects data consistency by making related data changes succeed together or have no effect.
- How deep it goes
- Defines atomicity and explains commit and rollback through a two-step transfer, without developing implementation details.
- Examples
- Uses a transfer between two accounts to show how a failed deposit can leave money missing.
- What you can do after
- Understand how a transaction prevents a partial transfer from leaving accounts inconsistent.
Read how Spring Start Here, Second Edition explains atomicity →
Grokking Concurrency
Atomicity is the property that an operation occurs as one indivisible action, either completing entirely or not taking effect.
- How it is used
- Prevents concurrent tasks from observing partial updates to shared primitive data.
- How deep it goes
- Explains all-or-nothing hardware execution and software support, but defers detailed implementation of atomic data structures.
- Examples
- Uses a counter increment and an assembly instruction adding one to a memory location.
- What you can do after
- Apply atomic data structures when supported, and substitute locks or message passing when atomicity is unavailable.
Learn Rust in a Month of Lunches
An atomic operation is an indivisible computer operation that appears to other threads as either fully completed or not performed.
- How it is used
- Uses atomicity to explain why Arc and Mutex are needed when threads access shared data.
- How deep it goes
- Defines indivisibility and demonstrates lost updates, but defers processor-level implementation details.
- Examples
- Uses concurrent counter increments and an Arc-wrapped Mutex to demonstrate lost and preserved updates.
- What you can do after
- Apply atomicity via Arc and Mutex when multiple threads update shared data.
Read how Learn Rust in a Month of Lunches explains atomicity →
Also covered in
- Unit Testing Principles, Practices, and Patterns
- Elixir in Action, Third Edition
- C++ Concurrency in Action, Second Edition
- Build Your Own Robot: Using Python, CRICKIT, and Raspberry Pi
- Architecting an Apache Iceberg Lakehouse
- Kafka for Architects
- Learn Haskell by Example
- The Coder CafeIn early access (MEAP)
- Kubernetes in Action, Second Edition
- Clean Applications with Hexagonal ArchitectureIn early access (MEAP)
- Hacking Cryptography
- Data-Oriented Programming in JavaIn early access (MEAP)
What to know first
- lockingLocking is a synchronization technique that controls concurrent access to a shared resource or protected operation.
- threadA thread is a distinct sequence of execution with its own control flow and state, managed or scheduled by a processor, runtime, or operating system.
- SQLSQL is a standardized declarative language for defining, querying, and manipulating data in relational database systems.
- multithreadingMultithreading is the execution of multiple threads of control within a program, concurrently through interleaving or simultaneously.
Related concepts
- ACIDpart of · ACID is the set of database transaction properties—atomicity, consistency, isolation, and durability—that characterize reliable transactional behavior.
- compare-and-swapincludes · Compare-and-swap is an atomic operation that replaces a value with a desired value only if the current value matches an expected value.
- read-modify-write operationincludes · A read-modify-write operation reads a value from a location, modifies or selects a new value, and writes the result back to that location.
- lock-free data structureuses · A concurrent data structure provides lock-free progress when operations do not require mutual-exclusion locks and, under contention, some operation completes in a finite number of steps.
- lock-freeused by · Lock-free is a concurrency progress guarantee under which at least one operation completes within a finite number of steps despite contention, without relying on mutual-exclusion locks.
- memory locationuses · A memory location is an addressable unit or region of computer memory identified for storing or accessing data or instructions.
Questions about atomicity
What is atomicity?
Atomicity is the property that an operation or group of operations takes effect as an indivisible whole, without observable partial effects.
Which Manning books explain atomicity?
GPU Programming with Triton, Learn Concurrent Programming with Go, API Design Patterns, Think Distributed Systems, Latency, 100 SQL Server Mistakes and How to Avoid Them, 100 Java Mistakes and How to Avoid Them, MongoDB 8.0 in Action, Third Edition and 11 more.
What should I know before learning atomicity?
Manning books that teach atomicity usually introduce locking, thread, SQL and multithreading first.
What kinds of atomicity are there?
Kinds of atomicity include compare-and-swap and read-modify-write operation.
What is atomicity part of?
Atomicity is part of ACID. ACID is the set of database transaction properties—atomicity, consistency, isolation, and durability—that characterize reliable transactional behavior.
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.


















