CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 4 Instructor: Haifeng YU.

Slides:



Advertisements
Similar presentations
Replicated Dictionary and Log
Advertisements

Distributed Snapshots: Determining Global States of Distributed Systems - K. Mani Chandy and Leslie Lamport.
Impossibility of Distributed Consensus with One Faulty Process
Last Class: Clock Synchronization
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 6 Instructor: Haifeng YU.
Lecture 8: Asynchronous Network Algorithms
Time and Clock Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
1 Causality. 2 The “happens before” relation happens before (causes)
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 7 Instructor: Haifeng YU.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Dinesh Bhat - Advanced Systems (Some slides from 2009 class) CS 6410 – Fall 2010 Time Clocks and Ordering of events Distributed Snapshots.
Distributed Systems Spring 2009
Ordering and Consistent Cuts Presented By Biswanath Panda.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Lecture 13 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Last quiz Max: 69 / Median: 52 / Min: 24 In a box outside.
Logical Time and Logical Clocks
Ordering and Consistent Cuts Presented by Chi H. Ho.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 10 Wenbing Zhao Cleveland State University.
Lecture 12 Synchronization. EECE 411: Design of Distributed Software Applications Summary so far … A distributed system is: a collection of independent.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.
Lecture 9: Time & Clocks CDK4: Sections 11.1 – 11.4 CDK5: Sections 14.1 – 14.4 TVS: Sections 6.1 – 6.2 Topics: Synchronization Logical time (Lamport) Vector.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Logical Clocks and Global State.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
Chapter 5.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Project Reference Some slides are in courtesy of Dr. Erciyes,
Hardware Supported Time Synchronization in Multi-Core Architectures 林孟諭 Dept. of Electrical Engineering National Cheng Kung University Tainan, Taiwan,
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 10 Instructor: Haifeng YU.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Issues with Clocks. Context The tree correction protocol was based on the idea of local detection and correction. Protocols of this type are complex to.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 8 Instructor: Haifeng YU.
UBI529 Distributed Algorithms 2. Time Synchronization in Distributed Systems.
“Virtual Time and Global States of Distributed Systems”
CSE 486/586 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Synchronization Chapter 5.
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Distributed Systems Principles and Paradigms Chapter 05 Synchronization.
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
CIS825 Lecture 2. Model Processors Communication medium.
9/14/20051 Time, Clocks, and the Ordering of Events in a Distributed System by L. Lamport CS 5204 Operating Systems Vladimir Glina Fall 2005.
Synchronization CSCI 4900/6900. Importance of Clocks & Synchronization Avoiding simultaneous access of resources –Cooperate to grant exclusive access.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 5 Instructor: Haifeng YU.
Feb 15, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements.
Event Ordering. CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of.
Hwajung Lee. Primary standard = rotation of earth De facto primary standard = atomic clock (1 atomic second = 9,192,631,770 orbital transitions of Cesium.
Lecture 1: Logical and Physical Time with some Applications Anish Arora CSE 6333 Notes include material from Dr. Jeff Brumfield.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 9 Instructor: Haifeng YU.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.
Time and Clock Primary standard = rotation of earth
Logical time (Lamport)
Distributed Systems CS
Event Ordering.
Outline Theoretical Foundations
CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
ITEC452 Distributed Computing Lecture 10 Time in a Distributed System
Chapter 5 (through section 5.4)
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Logical time (Lamport)
Logical time (Lamport)
Logical time (Lamport)
Presentation transcript:

CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 4 Instructor: Haifeng YU

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 22 Review of Last Lecture

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 23 Today’s Roadmap  Chapter 7 “Models and Clocks”  Goal: Define “time” in a distributed system  Logical clock  Vector clock  Matrix clock

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 24 Assumptions  Process can perform three kinds of atomic actions/events  Local computation  Send a single message to a single process  Receive a single message from a single process  No atomic broadcast  Communication model  Point-to-point  Error-free, infinite buffer  Potentially out of order

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 25 Motivation  Many protocols need to impose an ordering among events  If two players open the same treasure chest “almost” at the same time, who should get the treasure?  Physical clocks:  Seems to completely solve the problem  But what about theory of relativity?  Even without theory of relativity – efficiency problems  How accurate is sufficient?  Without out-of-band communication: Minimum message propagation delay  With out-of-band communication: distance/speed of light  In other words, some time it has to be “quite” accurate

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 26 Software “Clocks”  Software “clocks” can incur much lower overhead than maintaining (sufficiently accurate) physical clocks  Allows a protocol to infer ordering among events  Goal of software “clocks”: Capture event ordering that are visible to users  But what orderings are visible to users without physical clocks?

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 27 Visible Ordering to Users  A  B (process order)  B  C (send-receive order)  A  C (transitivity) user1 (process1) user2 (process2) user3 (process3) A B C D  A ? D  B ? D  C ? D

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 28 “Happened-Before” Relation  “Happened-before” relation captures the ordering that is visible to users when there is no physical clock  A partial order among events  Process-order, send-receive order, transitivity  First introduced by Lamport – Considered to be the first fundamental result in distributed computing  Goal of software “clock” is to capture the above “happened-before” relation

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 29 Software “Clock” 1: Logical Clocks  Each event has a single integer as its logical clock value  Each process has a local counter C  Increment C at each “local computation” and “send” event  When sending a message, logical clock value V is attached to the message. At each “receive” event, C = max(C, V) + 1 user1 (process1) user2 (process2) user3 (process3) = max(1,2) = max(3,3)+1

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 210 Logical Clock Properties  Theorem:  Event s happens before t  the logical clock value of s is smaller than the logical clock value of t.  The reverse may not be true user1 (process1) user2 (process2) user3 (process3)

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 211 Software “Clock” 2: Vector Clocks  Logical clock:  Event s happens before event t  the logical clock value of s is smaller than the logical clock value of t.  Vector clock:  Event s happens before event t  the vector clock value of s is “smaller” than the vector clock value of t.  Each event has a vector of n integers as its vector clock value  v1 = v2 if all n fields same  v1  v2 if every field in v1 is less than or equal to the corresponding field in v2  v1 < v2 if v1  v2 and v1 ≠ v2 Relation “<“ here is not a total order

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 212 Vector Clock Protocol  Each process i has a local vector C  Increment C[i] at each “local computation” and “send” event  When sending a message, vector clock value V is attached to the message. At each “receive” event, C = pairwise-max(C, V); C[i]++; user1 (process1) user2 (process2) user3 (process3) (1,0,0)(2,0,0)(3,0,0) (0,0,2) (0,2,2) (0,1,0) (0,0,1) (2,3,2) (2,3,3) C = (0,1,0), V = (0,0,2) pairwise-max(C, V) = (0,1,2)

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 213 Vector Clock Properties  Event s happens before t  vector clock value of s < vector clock value of t: There must be a chain from s to t  Event s happens before t  vector clock value of s < vector clock value of t  If s and t on same process, done  If s is on p and t is on q, let Vs be s’s vector clock and Vt be t’s  Vs < Vt  Vs[p] < Vt[p]  Must be a sequence of message from p to q after s and before t user2 (process2) user3 (process3) s t user1 (process1)

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 214 Example Application of Vector Clock  Each user has an order placed by a customer  Want all users to know all orders  Each order has a vector clock value user1 (process1) user2 (process2) user3 (process3) D1, (1,0,0)(2,0,0)(3,0,0) (0,0,2) (0,2,2) D2, (0,1,0) D3, (0,0,1) (2,3,2) (2,3,3) D1 D3 D1, D2, D3 I have seen all orders whose vector clock is smaller than (2,3,2): I can avoid linear search for existence testing

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 215 Software “Clock” 3: Matrix Clocks  Motivation  My vector clock describe what I “see”  In some applications, I also want to know what other people see  Matrix clock:  Each event has n vector clocks, one for each process  The i th vector on process i is called process i ’s principle vector  Principle vector is the same as vector clock before  Non-principle vectors are just piggybacked on messages to update “knowledge”

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 216 Matrix Clock Protocol  For principle vector C on process i  Increment C[i] at each “local computation” and “send” event  When sending a message, all n vectors are attached to the message  At each “receive” event, let V be the principle vector of the sender. C = pairwise-max(C, V); C[i]++;  For non-principle vector C on process i, suppose it corresponds to process j  At each “receive” event, let V be the vector corresponding to process j as in the received message. C = pairwise-max(C, V)

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 217 Matrix Clock Example user1 (process1) user2 (process2) user3 (process3) (1,0,0) (0,0,0) (0,1,0) (0,0,0) (0,0,1) (2,0,0) (0,0,0) (3,0,0) (0,0,0) (0,0,2) (0,0,0) (0,2,2) (0,0,2) (2,0,0) (2,3,2) (0,0,2) (2,0,0) (2,3,2) (2,3,3)

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 218 Matrix Clock Example (1,0,0) (0,0,0) (0,1,0) (0,0,0) (0,0,1) (2,0,0) (0,0,0) (3,0,0) (0,0,0) (0,0,2) (0,0,0) (0,2,2) (0,0,2) (2,0,0) (2,3,2) (0,0,2) (2,0,0) (2,3,2) (2,3,3) Theorem: On any given process, any non-principle vector is smaller than the principle vector.

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 219 Application of Matrix Clock user1 (process1) order D1 = (1,0,0) user2 (process2) order D2 = (0,1,0) user3 (process3) order D3 = (0,0,1) (1,0,0) (0,0,0) (0,1,0) (0,0,0) (0,0,1) (2,0,0) (0,0,0) (3,0,0) (0,0,0) (0,0,2) (0,0,0) (0,2,2) (0,0,2) (2,0,0) (2,3,2) (0,0,2) (2,0,0) (2,3,2) (2,3,3) D1 D3 D1, D2, D3 user3 now knows that all 3 users have seen D1

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 220 A Snack for Mind  Vector clock tells me what I know  one-dimensional data structure  Matrix clock tells me what I know about what other people know  Two-dimensional data structure  ?? tells me what I know about what other people know about what other people know  ??-dimensional data structure

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 221 Summary  Chapter 7 “Models and Clocks”  Goal: Define “time” in a distributed system  Logical clock  “happened before”  smaller clock value  Vector clock  “happened before”  smaller clock value  Matrix clock  Gives a process knowledge about what other processes know

CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 222 Homework Assignment  Prove the following:  If event s happens before t, then the logical clock value of s is smaller than the logical clock value of t.  Page 126  Problem 7.2 – give a counter-example  Problem 7.4  Problem 7.7 – Prove that the solution satisfies the property of logical clocks  Homework due a week from today