Atomicity (Transactions and Computing)
Atomicity is the guarantee that a set of operations executes as a single indivisible unit: either every operation completes successfully or none do. It is a core property of transactional systems and fault-tolerant computing.
Atomicity refers to the property that a group of actions is indivisible: from an external observer's point of view the system moves directly from a state before the group runs to a state after it has run, with no intermediate partial state visible. In computing this concept is most often discussed in the context of transactions in database and storage systems, where atomicity appears as the first of the four ACID properties. Modern database systems and transaction programs rely on atomicity to ensure logical correctness and to simplify error handling.
What atomicity guarantees
Atomicity means “all or nothing.” If every step inside a transaction completes, the transaction is committed and its effects persist. If any step fails, the transaction is rolled back and the system returns to the state that existed before the transaction began. Typical visible mechanisms are commit and rollback operations; implementation techniques include logging (undo/redo), journaling, and careful ordering of writes so that partial updates can be undone after a crash. A simple real-world example is transferring money between two accounts: either the debit and credit both happen or neither does.
How it is implemented
- Write-ahead logging and transaction logs allow systems to record intended changes before applying them, enabling recovery after failures.
- Locking and concurrency control prevent conflicting updates while a transaction runs; isolation and atomicity interact closely.
- In distributed systems, coordinated commit protocols (e.g., two-phase commit) are used to obtain atomicity across multiple nodes, though they introduce latency and blocking concerns.
- Where strict atomicity is impractical, systems sometimes use compensating transactions to undo partial work in application logic.
Many storage engines and relational databases implement atomic transactions natively; some modern NoSQL systems offer variants or weaker guarantees to trade consistency for availability and performance.
History and context
The importance of atomic transactions was articulated in database research during the 1970s and 1980s and later crystallized in the ACID model, which formalizes Atomicity, Consistency, Isolation and Durability. The ACID terminology and transactional techniques were developed and popularized by database researchers and practitioners as transaction processing systems grew in importance for business-critical applications.
Practical trade-offs and distinctions
Strict atomicity simplifies application logic but comes with costs: higher latency, more coordination in distributed settings, and potential scalability limits. Designers sometimes prefer eventual consistency or idempotent operation patterns when absolute atomicity across many services is infeasible. Atomicity should also be distinguished from related concepts: isolation controls how concurrent transactions interact, durability ensures committed changes survive crashes, and idempotency ensures repeated operations have the same effect.
For a concise introduction to transactions and the ACID model see ACID and for practical examples of transaction failure and recovery see transaction literature and tutorials.
Related articles
Author
AlegsaOnline.com Atomicity (Transactions and Computing) Leandro Alegsa
URL: https://en.alegsaonline.com/art/7057