Question 2 of 3 · CIE-1 QB · CIE-1 paper · 7 marks
Open in ChatGPTExplain Data-Centric Consistency Models in distributed systems. Discuss any three models with suitable examples.
Introduction
A data store is replicated to keep it available, so a read may reach a copy that has not yet seen the latest write. A consistency model is the contract that says which value a read is allowed to return. Data-centric models describe the behaviour of the store itself, independent of who reads it.
Diagram
1. Strict consistency
Any read on any replica returns the value of the most recent write, as if there were one copy.
- A write of
x = 1at time t is seen by every read issued after t, on every replica. - It is impossible to build on a distributed system with message delays; it is the reference model only.
2. Sequential consistency
There is one total order of all operations, and each client's operations appear in that order in the sequence it issued them.
- If P1 writes
x = 1and P2 writesx = 2, every replica must show either the order1then2, or2then1: never a mixture. - Example: two processes append to a shared log; every replica sees the appends in the same order, though not necessarily the real-time order.
3. Causal consistency
Writes that are causally related must be seen in the same order everywhere; concurrent writes may be seen in different orders on different replicas.
- If P1 writes
x = 1and then, after reading it, P1 writesy = 2, no replica may showy = 2withoutx = 1. - Example: comment and reply. A replica that shows the reply must already show the comment it answers.
4. Weak consistency
A synchronization variable is used: the store guarantees consistency only after a synchronize operation.
- Writes are not propagated at all until the client synchronizes.
- Example: a shared file edited offline, then synchronised on reconnect.
Comparison
| Model | Guarantee | Ordering | Costs |
|---|---|---|---|
| Strict | Real-time single copy | Global, real time | Not implementable |
| Sequential | One total order, all clients | Global, not real time | Performance |
| Causal | Causally related writes ordered | Partial | Cheap, common |
| Weak | Consistent only after sync | None between syncs | Client effort |
Conclusion
The stronger the model, the more coordination each read and write needs. Real systems choose causal or weak consistency because they accept stale data in exchange for availability and low latency.