Sequential Consistency
What you'll learn: How sequential consistency preserves per-process ordering while allowing flexibility in global execution order across distributed systems.
The Core Idea
Sequential consistency is a memory model that guarantees operations from each individual process appear to execute in the order that process issued them, but the interleaving of operations across different processes can vary. Think of it as each person following their own script in order, but the director can shuffle how those scripts weave together.
This is slightly weaker than strong consistency (linearizability), which you just learned requires a single, global order that matches real-time. Sequential consistency relaxes the real-time requirement but maintains program order within each process.
How It Works
Imagine three processes executing operations:
- Process A: writes X=1, then X=2
- Process B: reads X twice
- Process C: reads X twice
Sequential consistency guarantees:
- Process A's writes happen in order (X=1 before X=2)
- But processes B and C might see different orderings relative to each other
- Process B might see [1, 2] while Process C sees [2, 2]—both valid!
The key: no global clock synchronization needed. Each process's local ordering is preserved, but you can't necessarily determine which operation happened "first" across processes in real-time.
Why It Matters
Sequential consistency is easier to implement than linearizability because it doesn't require expensive real-time coordination. Many programming languages' memory models (like Java's happens-before with proper synchronization) provide sequential consistency guarantees for shared variables.
Key Takeaway: Sequential consistency maintains each process's operation order but allows different global views of execution across processes—a practical middle ground between strong consistency and total chaos.