90 likes | 307 Views
Consistency and Replication. CSCI 4780/6780. Sequential Consistency. Slightly weaker consistency model
E N D
Consistency and Replication CSCI 4780/6780
Sequential Consistency • Slightly weaker consistency model • “The result of any execution is the same as if the read & write operations by all the processes on the data store were executed in some sequential order and the operations of each individual process appear in this sequence in the order specified by its program” • Any valid interleaving of read and write operations • All processes should see the same interleaving of operations • Time does not play a role in this model
Sequential Consistency - Example • A sequentially consistent data store. • A data store that is not sequentially consistent.
Causal Consistency • Weaker than sequential consistency • Differentiates between causally related events and those that are not • Example: Process P1 writes x. Process P2 reads x and writes y. Reading of x and writing on y are potentially causally related. However two independent writes are not causally related • “Writes that are potentially casually related must be seen by all processes in the same order. Concurrent writes may be seen in a different order on different machines.”
Casual Consistency - Example • This sequence is allowed with a casually-consistent store, but not with sequentially or strictly consistent store.
Casual Consistency- Example [Contd.] • A violation of a casually-consistent store. • A correct sequence of events in a casually-consistent store.
Operation Grouping • Sequential and causal consistency are at the granularity of reads/writes • Suits hardware implementation • Does not match the granularity of applications • Concurrency control through synchronization mechanisms • ENTER_CS and LEAVE_CS primitives • Brackets a series of reads and writes into an atomic unit • Acquire and Release lock • Owner of an variable • Exclusive and non-exclusive modes
Grouping Operations • Necessary criteria for correct synchronization: • An acquire access of a synchronization variable, not allowed to perform until all updates to guarded shared data have been performed with respect to that process. • Before exclusive mode access to synchronization variable by process is allowed to perform with respect to that process, no other process may hold synchronization variable, not even in nonexclusive mode. • After exclusive mode access to synchronization variable has been performed, any other process’ next nonexclusive mode access to that synchronization variable may not be performed until it has performed with respect to that variable’s owner.
Grouping Operations - Example • Figure 7-10. A valid event sequence for entry consistency.