SEQUENTIAL CONSISTENCY MODEL AND LINEARIZABILITY MODEL IN DISTRIBUTED SYSTEM

Sequential Consistency Model and Linearizability Model in Distributed System(Base Models).Sequential Consistency Model In Distributed System Consistency Models In Distributed Systems Causal Consistency In Distributed System Consistency Models In Distributed Systems Video Lecture. Implementing Sequential Consistency Model Linearizability Vs. Sequential Consistency Examples Distributed Systems Replication And Consistency Distributed Systems.

play-rounded-fill play-rounded-outline play-sharp-fill play-sharp-outline
pause-sharp-outline pause-sharp-fill pause-rounded-outline pause-rounded-fill
00:00
ยฉ 2018 Flowplayer ABAbout FlowplayerGPL based license

Sequential Consistency and Linearizability in Distributed Systems

In distributed systems, maintaining consistency is a crucial challenge. Two important consistency models used to define how operations should be executed and observed are Sequential Consistency and Linearizability. These models help in designing reliable and predictable systems, ensuring correct execution of concurrent operations.



 What is Sequential Consistency?

 Definition

Sequential Consistency ensures that the result of execution is as if all operations were executed in some sequential order, and each process sees operations in the same order. However, it does not guarantee real-time execution order.

Key Property:
Operations from different processes may be interleaved, but they must respect the program order within each process.

 Example of Sequential Consistency

Consider two processes (P1 and P2) updating a shared variable X, initially set to 0.

Operations:

P1: X = 1
P2: print(X) (can see X = 0 or X = 1, depending on execution order)

Possible Sequentially Consistent Execution Orders:
Order 1: P1 โ†’ P2 โ†’ (P2 sees X = 1)
Order 2: P2 โ†’ P1 โ†’ (P2 sees X = 0)

Even though execution may not match real-time order, all processes see changes in a consistent sequence.

 What is Linearizability?

 Definition

Linearizability (Atomic Consistency) is a stronger consistency model than Sequential Consistency. It ensures that each operation appears to take effect instantaneously at some point between its start and end time.

Key Property:
All operations must appear to execute in a real-time order. If operation A completes before operation B starts, then A must be observed before B.

 Example of Linearizability

Consider the same shared variable X with processes P1 and P2.

Operations:

P1: X = 1
P2: print(X)

If P2 starts reading after P1 has updated X, P2 must see X = 1.
Linearizability ensures that no process ever sees an outdated value after an update.

 Difference Between Sequential Consistency and Linearizability

Feature Sequential Consistency Linearizability
Ordering Preserves execution order but allows reordering across processes Preserves both execution order and real-time constraints
Real-Time Guarantee No Yes
Use Case Useful in systems where exact real-time order is not required Required in financial transactions, database consistency, and real-time systems
Performance Better performance as it allows reordering Expensive as it requires strict order maintenance

 Real-World Use Cases

Sequential Consistency:
Cloud Storage (Amazon S3, Google Drive) โ€“ Ensures eventual order but does not guarantee real-time updates.
Distributed Caching โ€“ Helps in optimizing performance by allowing relaxed ordering.

Linearizability:
Bank Transactions (Atomicity in Databases) โ€“ Ensures that withdrawals and deposits reflect in real-time.
Leader Election (Raft, Paxos) โ€“ Ensures strict order in distributed consensus.

 Summary

Sequential Consistency ensures operations appear in some global sequence, but real-time execution may be violated.
Linearizability is a stronger guarantee where operations must appear instantaneous and respect real-time order.
Linearizability is expensive but necessary for critical systems like banking and distributed databases.

 Which consistency model do you think is more suitable for real-world distributed systems?

Hereโ€™s a detailed and clear comparison of the Sequential Consistency Model and the Linearizability Model in distributed systems โ€” two important consistency models used to reason about the behavior of concurrent systems like databases, caches, and shared memory.


๐Ÿง  Consistency Models in Distributed Systems

In distributed systems, consistency models define the rules for the visibility and ordering of read/write operations across multiple nodes or processes.

The two commonly discussed models are:


๐Ÿ”น 1. Sequential Consistency Model

๐Ÿ“˜ Definition:

A system is sequentially consistent if the result of execution is the same as if:

  • All operations were executed in some sequential order

  • The order of operations of each individual process is preserved

๐Ÿงช Example:

Letโ€™s say two processes perform the following writes:

css
P1: write(x = 1)
P2: write(x = 2)

Then any sequential consistency-compliant system might produce:

  • P1 sees: 1, then 2

  • P2 sees: 1, then 2
    OR

  • Both see: 2, then 1
    BUT NOT

  • P1 sees: 1, 2
    P2 sees: 2, 1 (violates process order)

โœ… Key Properties:

  • Preserves program order per process

  • Doesnโ€™t require a real-time order between operations


๐Ÿ”ธ 2. Linearizability (Atomic Consistency) Model

๐Ÿ“˜ Definition:

A system is linearizable if:

  • The result is as if operations occurred in some global sequential order

  • AND this order respects real-time โ€” if operation A completes before B starts, then A appears before B

๐Ÿงช Example:

Let:

  • P1: write(x = 1) finishes at time T1

  • P2: write(x = 2) starts at time T2 > T1

Then all processes must see x = 2 after time T2, not x = 1.

โœ… Key Properties:

  • Stronger than sequential consistency

  • Matches real-world intuition of time and operation visibility

  • Guarantees immediate visibility


๐Ÿ” Sequential Consistency vs Linearizability

Feature Sequential Consistency Linearizability
Operation Order Preserves per-process order Preserves real-time order
Global View Appears as one sequence Appears as one sequence with real-time constraint
Strength Weaker than linearizability Stronger
Performance More scalable Less scalable (requires stricter coordination)
Example Use CPU memory models, shared variables Distributed databases, locks, registers

๐Ÿง  Analogy

  • ๐Ÿงฉ Sequential Consistency: Everyone agrees on what happened, but not exactly when.

  • โฑ๏ธ Linearizability: Everyone agrees on what and when it happened, respecting real-world time.


๐Ÿ Conclusion

  • Sequential Consistency: Suitable when timing doesnโ€™t matter, but order does.

  • Linearizability: Used when strong guarantees are needed (e.g., banking systems, locks, atomic registers).


Would you like this as:

  • ๐Ÿ“Š A presentation?

  • ๐Ÿ“ Lecture notes or handout?

  • ๐Ÿงช Example code to simulate consistency in Python?

Let me know!

SEQUENTIAL CONSISTENCY MODEL AND LINEARIZABILITY MODEL IN DISTRIBUTED SYSTEM

Sequential, Causal, and Eventual Consistency



Diznr International

Diznr International is known for International Business and Technology Magazine.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: