Consistency. Consistency model: –A constraint on the system state observable by applications Examples: –Local/disk memory : –Database: What is consistency?

Slides:



Advertisements
Similar presentations
1 Lecture 20: Synchronization & Consistency Topics: synchronization, consistency models (Sections )
Advertisements

Relaxed Consistency Models. Outline Lazy Release Consistency TreadMarks DSM system.
CS 162 Memory Consistency Models. Memory operations are reordered to improve performance Hardware (e.g., store buffer, reorder buffer) Compiler (e.g.,
(c) Oded Shmueli Transactions Lecture 1: Introduction (Chapter 1, BHG) Modeling DB Systems.
Distributed Shared Memory
Consistency Models Based on Tanenbaum/van Steen’s “Distributed Systems”, Ch. 6, section 6.2.
Cache Coherent Distributed Shared Memory. Motivations Small processor count –SMP machines –Single shared memory with multiple processors interconnected.
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
By Sarita Adve & Kourosh Gharachorloo Review by Jim Larson Shared Memory Consistency Models: A Tutorial.
CS252/Patterson Lec /23/01 CS213 Parallel Processing Architecture Lecture 7: Multiprocessor Cache Coherency Problem.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Distributed Resource Management: Distributed Shared Memory
Ordering of events in Distributed Systems & Eventual Consistency Jinyang Li.
CSS434 DSM1 CSS434 Distributed Shared Memory Textbook Ch18 Professor: Munehiro Fukuda.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Shared Memory.
Distributed Shared Memory and Sequential Consistency.
Distributed Shared Memory: A Survey of Issues and Algorithms B,. Nitzberg and V. Lo University of Oregon.
Lazy Release Consistency for Software Distributed Shared Memory Pete Keleher Alan L. Cox Willy Z.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Shared Memory: Ivy & memcached Costin Raiciu Advanced Topics in Distributed Systems 2012 Slides courtesy of Brad Karp (UCL) and Robert Morris.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
B. Prabhakaran 1 Distributed Shared Memory DSM provides a virtual address space that is shared among all nodes in the distributed system. Programs access.
TECHNIQUES FOR REDUCING CONSISTENCY- RELATED COMMUNICATION IN DISTRIBUTED SHARED-MEMORY SYSTEMS J. B. Carter University of Utah J. K. Bennett and W. Zwaenepoel.
Memory Coherence in Shared Virtual Memory System ACM Transactions on Computer Science(TOCS), 1989 KAI LI Princeton University PAUL HUDAK Yale University.
CS425/CSE424/ECE428 – Distributed Systems Nikita Borisov - UIUC1 Some material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra,
Ch 10 Shared memory via message passing Problems –Explicit user action needed –Address spaces are distinct –Small Granularity of Transfer Distributed Shared.
Distributed Shared Memory Based on Reference paper: Distributed Shared Memory, Concepts and Systems.
By Sarita Adve & Kourosh Gharachorloo Slides by Jim Larson Shared Memory Consistency Models: A Tutorial.
Distributed Shared Memory (part 1). Distributed Shared Memory (DSM) mem0 proc0 mem1 proc1 mem2 proc2 memN procN network... shared memory.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Replication (1). Topics r Why Replication? r System Model r Consistency Models – How do we reason about the consistency of the “global state”? m Data-centric.
Consider the program fragment below left. Assume that the program containing this fragment executes t1() and t2() on separate threads running on separate.
Distributed Shared Memory: Ivy Brad Karp UCL Computer Science CS GZ03 / M th, 16 th October, 2008.
Multiprocessor Cache Consistency (or, what does volatile mean?) Andrew Whitaker CSE451.
Implementation and Performance of Munin (Distributed Shared Memory System) Dongying Li Department of Electrical and Computer Engineering University of.
Replication (1). Topics r Why Replication? r System Model r Consistency Models r One approach to consistency management and dealing with failures.
ECE 1747: Parallel Programming Basics of Parallel Architectures: Shared-Memory Machines.
CIS 720 Distributed Shared Memory. Shared Memory Shared memory programs are easier to write Multiprocessor systems Message passing systems: - no physically.
Chapter 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University Building Dependable Distributed Systems.
CS533 Concepts of Operating Systems Jonathan Walpole.
Lazy Release Consistency for Software Distributed Shared Memory Pete Keleher Alan L. Cox Willy Z. By Nooruddin Shaik.
1 Lecture 19: Scalable Protocols & Synch Topics: coherence protocols for distributed shared-memory multiprocessors and synchronization (Sections )
Distributed shared memory u motivation and the main idea u consistency models F strict and sequential F causal F PRAM and processor F weak and release.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 16: Distributed Shared Memory 1.
EEC 688/788 Secure and Dependable Computing Lecture 9 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Transactional Memory Coherence and Consistency Lance Hammond, Vicky Wong, Mike Chen, Brian D. Carlstrom, John D. Davis, Ben Hertzberg, Manohar K. Prabhu,
Lecture 28-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) December 2, 2010 Lecture 28 Distributed.

Database Transaction Abstraction I
Distributed Shared Memory
Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013
Consistency and Replication
Lecture 18: Coherence and Synchronization
Ivy Eva Wu.
Replication and Consistency
Consistency Models.
Replication and Consistency
Outline Midterm results summary Distributed file systems – continued
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Distributed Shared Memory
CSS490 Distributed Shared Memory
Shared Memory Consistency Models: A Tutorial
Lecture 25: Multiprocessors
Distributed Systems CS
Lecture 24: Multiprocessors
EEC 688/788 Secure and Dependable Computing
Distributed Resource Management: Distributed Shared Memory
Lecture 18: Coherence and Synchronization
Replication and Consistency
Presentation transcript:

Consistency

Consistency model: –A constraint on the system state observable by applications Examples: –Local/disk memory : –Database: What is consistency? read x (should be 5)write x=5 time x:=x+1; y:=y-1assert(x+y==const) time Single object consistency, also called “ coherence ” Consistency across >1 objects

Consistency challenges No right or wrong consistency models –Tradeoff between ease of programmability and efficiency –E.g. what’s the consistency model for web pages? Consistency is hard in (distributed) systems: –Data replication (caching) –Concurrency –Failures

Example application program Is this program correct? x=1 If y==0 critical section y=1 If x==0 critical section CPU 0CPU 1 Memory system READ/WRITE

Example CPU0’s instruction stream: W(x) R(y) CPU1’s instruction stream: W(y) R(x) Enumerate all possible inter-leavings: –W(x)1 R(y)0 W(y)1 R(x)1 –W(x)1 W(y)1 R(y)1 R(x)1 –W(x)1 W(y)1 R(x)1 R(y)1 –…. None violates mutual exclusion x=1 If y==0 critical section y=1 If x==0 critical section

An example distributed shared memory Each node has a local copy of state Read from local state Send writes to the other node, but do not wait

Consistency challenges: example W(x)1 W(y)1 x=1 If y==0 critical section y=1 If x==0 critical section

Does this work? R(y)0 W(x)1W(y)1 R(x)0 x=1 If y==0 critical section y=1 If x==0 critical section

What went wrong? W(x)1W(y)1 CPU0 sees: W(x)1 R(y)0 CPU1 sees: W(y)1 R(x)0 R(y)0 R(x)0

Strict consistency Each operation is stamped with a global wall-clock time Rules: 1. Each read gets the latest write value 2. All operations at one CPU have time- stamps in execution order

No two CPUs in the critical section Proof: suppose mutual exclusion is violated CPU0: W(x)1 R(y)0 CPU1: W(y)1 R(x)0 Rule 1: read gets latest write CPU0: W(x)1 R(x)0 CPU1: W(y)1 R(x)0 Strict consistency gives “intuitive” results W must have timestamp later than R Contradicts rule 1: R must see W(x)1

Sequential consistency Strict consistency is not practical –No global wall-clock available Sequential consistency is the closest Rules: There is a total order of ops s.t. –Each CPUs’ ops appear in order –All CPUs see results according to total order (i.e. reads see most recent writes)

Sequential consistency is also intuitive Recall our proof for correctness Enumerate all possible total orders s.t.: –Each CPUs’ ops appear in order –All CPUs see results according to total order (i.e. reads see most recent writes) Show no total order violates mutual excl

Naive DSM example gives no sequential consistency W(x)1W(y)1 CPU0 sees: W(x)1 R(y)0 W(y)1 CPU1 sees: W(y)1 R(x)0 W(x)1 No total order can explain explain this execution R(y)0 R(x)0

Sequential consistency is easier to implement There’s no notion of real time System is free to order concurrent events However, when the system finishes a write or reveals a read, it commits to certain partial orders

Requirement for sequential consistency 1.Each processor issues requests in the order specified by the program –Do not issue the next request unless the previous one has finished 2.Requests to an individual memory location (storage object) are served from a single FIFO queue. –Writes occur in a single order –Once a read observes the effect of a write, it’s ordered behind that write

Naive DSM violates R1,R2 W(x)1W(y)1 R1: a processor issues read before waiting for write to complete R2: 2 processors issue writes concurrently, no single order R(y)0 R(x)0 Read from local state Send writes to the other node, but do not wait

Ivy distributed shared memory What does Ivy do? –Provide a shared memory system across a group of workstations Why shared memory? –Easier to write parallel programs with than using message passing –We’ll come back to this choice of interface in later lectures

Ivy architecture Each node caches read pages –Why? Can a node directly write cached pages? Each processor’s local memory keeps a subset of all pages If page not found in local memory, request from remote node

Ivy aims to provide sequential consistency How? –Always read a fresh copy of data Must invalidate all cached pages before writing a page. This simulates the FIFO queue for a page because once a page is written, all future reads must see the latest value –Only one processor (owner) can write a page at a time

Ivy implementation The ownership of a page moves across nodes –Latest writer becomes the owner –Why? Challenge: –how to find the owner of a page? –how to ensure one owner per page? –How to ensure all cached pages are invalidated?

Ivy: centralized manager manager Page#, copy_set, owner p1, {..}, {A} Page#, access p1, read A BC

Ivy: read Manager Page#, copy_set, owner p1, {}, {A} A BC 1.Page fault for p1 on C 2.C sends RQ(read request) to M 3.M sends RF(read forward) to A, M adds C to copy_set 4.A sends p1 to C, C marks p1 as read-only 5.C sends RC(read confirmation) to M 2:RQ5:RC 3:RF p1, {C}, {A} Page#, access p1, read 4:p1 Page#, access p1, read

Ivy: write Manager Page#, copy_set, owner p1, {C}, {A} A BC 1.Page fault for p1 on B 2.B sends WQ(write request) to M 3.M sends IV(invalidate) to copy_set = {C} 4.C sends IC(invalidate confirm) to M 5.M clears copy_set, sends WF(write forward) to A 6.A sends p1 to B, clears access 7.B sends WC(write confirmation) to M Page#, access p1, write Page#, access p1, read 2:WQ 3:IV 4:IC p1, nil Page#, access p1, write p1, nil 6:p1 7:WC 5:WF p1, {}, {B}

Ivy properties Does Ivy work with our example app? Why does it need RC and WC messages? x=1 If y==0 critical section y=1 If x==0 critical section

Ivy invariants? Every page has exactly one current owner Current owner has a copy of the page If mapped r/w by owner, no other copies If mapped r/o by owner, identical to other copies Manager knows about all copies