{"slug":"linearizability","title":"Linearizability","summary":"Linearizability is a strong consistency condition for concurrent and distributed systems that ensures operations appear to occur instantaneously in a real-time-respecting sequential order, providing atomicity guarantees while preserving system invariants.","content_md":"# Linearizability\n\n**Linearizability** is a fundamental correctness condition for concurrent and distributed systems that ensures operations appear to occur instantaneously in a single, sequential order while respecting the real-time ordering of events [1][2]. First formally defined by Maurice Herlihy and Jeannette Wing in 1990, linearizability provides a strong consistency guarantee that makes concurrent systems behave as if they were sequential, greatly simplifying reasoning about system correctness [4].\n\n## Core Concept\n\nLinearizability guarantees that once an operation completes, its effects are immediately visible to all subsequent operations in the system [5]. This means that if a write operation finishes at time T, any read operation that begins after time T will observe the effects of that write or the effects of an even later write operation [3].\n\nThe key insight behind linearizability is that it exploits the semantics of abstract data types to permit high degrees of concurrency while maintaining correctness [4]. Unlike serializability, which only requires that operations appear to execute in some sequential order, linearizability additionally requires that this order respects the real-time ordering of non-overlapping operations [2].\n\n## Formal Definition\n\nAn execution is linearizable if there exists a sequential execution that:\n\n1. **Preserves the program order**: If operation A completes before operation B begins in real time, then A must appear before B in the sequential execution\n2. **Respects the sequential specification**: The sequential execution must be consistent with the sequential specification of the data type\n3. **Maintains atomicity**: Each operation appears to take effect instantaneously at some point between its invocation and response [1][8]\n\n## Properties and Guarantees\n\n### Atomicity\nLinearizability ensures that operations are atomic - they appear to occur instantaneously rather than over a duration [1]. This atomicity guarantee means that no operation can observe a system in an intermediate state during another operation's execution.\n\n### Real-time Ordering\nUnlike other consistency models, linearizability respects the real-time ordering of operations. If operation A completes before operation B begins (according to a global clock), then A must appear before B in any linearizable execution [2].\n\n### Invariant Preservation\nLinearizability guarantees that system invariants are observed and preserved by all operations. If individual operations preserve an invariant, the system as a whole will maintain that invariant under concurrent execution [1].\n\n## Implementation Challenges\n\nImplementing linearizable systems presents several technical challenges:\n\n### Distributed Coordination\nIn distributed systems, achieving linearizability often requires coordination between nodes to ensure a consistent global ordering of operations [7]. This coordination can introduce performance overhead and potential bottlenecks.\n\n### Performance Trade-offs\nThe strong guarantees provided by linearizability come at a cost. Systems must often sacrifice performance, availability, or partition tolerance to maintain linearizable consistency, as suggested by the CAP theorem.\n\n### Replication Complexity\nAll difficulty in replication lies in handling changes to replicated data while maintaining linearizability [7]. Systems must ensure that updates are applied consistently across all replicas while preserving the real-time ordering constraints.\n\n## Applications and Use Cases\n\n### Database Systems\nLinearizability is crucial for database systems where strong consistency is required. It ensures that transactions appear to execute atomically and in a consistent order across all database replicas.\n\n### Distributed Storage\nModern distributed storage systems often implement linearizable consistency for critical operations, ensuring that once data is written, all subsequent reads will observe that data or newer versions.\n\n### Concurrent Data Structures\nLinearizability serves as a correctness condition for concurrent data structures, allowing programmers to reason about their behavior using sequential specifications [6].\n\n## Relationship to Other Consistency Models\n\n### Sequential Consistency\nWhile sequential consistency only requires that operations appear in some sequential order consistent with program order, linearizability additionally requires respect for real-time ordering. This makes linearizability strictly stronger than sequential consistency.\n\n### Serializability\nLinearizability extends serializability to distributed environments by adding real-time constraints [2]. While serializability is sufficient for single-node systems, distributed systems require the additional guarantees provided by linearizability.\n\n### Eventual Consistency\nLinearizability provides immediate consistency, contrasting with eventual consistency models that only guarantee convergence over time. This makes linearizability suitable for applications requiring strong consistency guarantees.\n\n## Verification and Testing\n\nVerifying linearizability in practice involves checking that concurrent executions can be mapped to valid sequential executions. This process typically requires:\n\n1. Recording the start and end times of all operations\n2. Finding a sequential ordering that respects real-time constraints\n3. Verifying that the sequential ordering satisfies the data type's specification\n\nModern testing frameworks and formal verification tools provide automated support for linearizability checking, making it more practical to verify system correctness.\n\n## Related Topics\n\n- Serializability\n- Sequential Consistency\n- Concurrent Data Structures\n- Distributed Systems Consistency\n- CAP Theorem\n- Atomic Operations\n- Consensus Algorithms\n- Memory Models\n\n## Summary\n\nLinearizability is a strong consistency condition for concurrent and distributed systems that ensures operations appear to occur instantaneously in a real-time-respecting sequential order, providing atomicity guarantees while preserving system invariants.\n\n\n\n","sources":[{"url":"https://en.wikipedia.org/wiki/Linearizability","title":"Linearizability - Wikipedia","snippet":"An atomic object can be understood ... the other; no inconsistencies may emerge. Specifically, linearizability guarantees that the invariants of a system are observed and preserved by all operations: if all operations individually preserve an invariant, the system as a whole ..."},{"url":"https://www.geeksforgeeks.org/system-design/linearizability-in-distributed-systems/","title":"Linearizability in Distributed Systems - GeeksforGeeks","snippet":"Linearizability is a consistency model in distributed systems ensuring that operations appear to occur instantaneously in a single, sequential order, respecting the real-time sequence of events. It extends the concept of serializability to distributed environments, guaranteeing that all nodes see operations in the same order. This model is crucial for maintaining consistency in distributed ..."},{"url":"https://www.educative.io/answers/what-is-linearizability-in-distributed-systems","title":"What is linearizability in distributed systems? - Educative","snippet":"In the following example, we have a distributed system consisting of three different processes: P1, P2, and P3. Client A writes a value 1 to an object A. Given that the system is linearizable, once the write operation completes, all later reads, by global time, should return the value of that write or the value of the later write operation."},{"url":"https://dl.acm.org/doi/10.1145/78969.78972","title":"Linearizability: a correctness condition for concurrent objects | ACM Transactions on Programming Languages and Systems","snippet":"Linearizability is a correctness condition for concurrent objects that exploits the semantics of abstract data types. It permits a high degree of concurrency, yet it permits programmers to specify and reason about concurrent objects using known ..."},{"url":"https://vladmihalcea.com/linearizability/","title":"A beginner's guide to Linearizability - Vlad Mihalcea","snippet":"Linearizability means that modifications happen instantaneously, and once a registry value is written, any subsequent read operation will find the very same value as long as the registry will not undergo any modification."},{"url":"https://cacm.acm.org/research/a-linearizability-based-hierarchy-for-concurrent-specifications/","title":"A Linearizability-based Hierarchy for Concurrent Specifications – Communications of the ACM","snippet":"Linearizability precludes such ... by definition, linearizability is a tool to show that a concurrent algorithm implements a problem specified through a sequential specification (see sidebars 1 and 2)...."},{"url":"https://hongilkwon.medium.com/what-is-linearizability-in-distributed-system-db8bca3d432d","title":"What is Linearizability in Distributed System? | by James Kwon | Medium","snippet":"All of the difficulty in replication lies in handling changes to replicated data. Linearizability provides certain guarantees on a system, which simplifies interaction of dependent applications by relying on these guarantees."},{"url":"https://dagster.io/glossary/linearizability","title":"What Is Linearizability | Dagster","snippet":"Linearizability is a correctness condition that ensures that all operations on a distributed system (such as reads, writes, and updates to a data store) appear to occur instantaneously at some point between their start and end times. It constrains what outputs are possible when an object is accessed by multiple processes concurrently..."}],"infobox":{"Type":"Consistency Model","Field":"Distributed Systems","Authors":"Maurice Herlihy, Jeannette Wing","Strength":"Strong Consistency","Key Property":"Real-time ordering preservation","First Described":"1990","Application Domain":"Concurrent and distributed systems"},"metadata":{"tags":["distributed-systems","consistency-models","concurrent-programming","linearizability","atomicity","correctness-conditions"],"quality":{"status":"generated","reviewed_by":[],"flagged_issues":[]},"category":"Technology","difficulty":"advanced","subcategory":"Distributed Systems"},"model_used":"anthropic/claude-4-sonnet-20250522","revision_number":1,"view_count":9,"related_topics":[],"sections":["Linearizability","Core Concept","Formal Definition","Properties and Guarantees","Atomicity","Real-time Ordering","Invariant Preservation","Implementation Challenges","Distributed Coordination","Performance Trade-offs","Replication Complexity","Applications and Use Cases","Database Systems","Distributed Storage","Concurrent Data Structures","Relationship to Other Consistency Models","Sequential Consistency","Serializability","Eventual Consistency","Verification and Testing","Related Topics","Summary"]}