© Chinese University, CSE Dept. Distributed Systems / 9 - 1 Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.

Slides:



Advertisements
Similar presentations
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Advertisements

Computer Science 425 Distributed Systems CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
Time and Global States Ali Fanian Isfahan University of Technology
Distributed Systems Fall 2010 Replication Fall 20105DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Distributed Systems Spring 2009
CS 582 / CMPE 481 Distributed Systems Synchronization.
CS 582 / CMPE 481 Distributed Systems
Distributed Systems Fall 2010 Time and synchronization.
CS 582 / CMPE 481 Distributed Systems
Distributed Systems Fall 2009 Coordination and agreement, Multicast, and Message ordering.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
CS 582 / CMPE 481 Distributed Systems Replication.
Time and Global States Chapter 11. Why time? Time is an Important and interesting issue in distributes systems. One we can measure accurately. Can use.
Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley Copyright © George Coulouris, Jean Dollimore, Tim.
Distributed Systems CS Synchronization – Part II Lecture 8, Sep 28, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
1 Slides for Chapter 10: Time (and Global State) From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
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 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
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.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
1DT066 D ISTRIBUTED I NFORMATION S YSTEM Time, Coordination and Agreement 1.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Time and Coordination March 13, Time and Coordination What is time? :-)  Issue: How do you coordinate distributed computers if there is no global.
TIME AND GLOBAL STATES Đàm Vĩnh Tường ( ) Nguyễn Lê Anh Đào ( ) Trần Viễn Phúc ( )
1 Time (and Global State). 3 Time – basics zWe want to know when something happened - Physical and logical clocks. zAlgorithms may depend upon clock.
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.
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
1 Clock Synchronization & Mutual Exclusion in Distributed Operating Systems Brett O’Neill CSE 8343 – Group A6.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Lecture 9: Time and clocks (Chap 11) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
Fault Tolerant Services
Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down,
Time and global states Chapter 11. Outline Introduction Clocks, events and process states Synchronizing physical clocks Logical time and logical clocks.
Distributed Systems CS Synchronization – Part I Lecture 8, Sep 23, 2013 Mohammad Hammoud.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 8: Fault Tolerance and Replication Dr. Michael R. Lyu Computer Science.
Distributed Systems Topic 5: Time, Coordination and Agreement
CS 582 / CMPE 481 Distributed Systems Synchronization.
Lecture 10: Coordination and Agreement (Chap 12) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
Distributed Systems Lecture 5 Time and synchronization 1.
CSE 486/586 CSE 486/586 Distributed Systems Time and Synchronization Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Computing Systems Replication Dr. Sunny Jeong. Mr. Colin Zhang With Thanks to Prof. G. Coulouris,
Distributed Web Systems Time and Global State Lecturer Department University.
Replication Chapter Katherine Dawicki. Motivations Performance enhancement Increased availability Fault Tolerance.
Topic 7: Time and Global State Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Coordination and Agreement
Distributed Computing
Time and Global States Ali Fanian Isfahan University of Technology
Lecture 5 Time and synchronization
CSE 486/586 Distributed Systems Time and Synchronization
Logical time (Lamport)
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Active replication for fault tolerance
Physical clock synchronization
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Logical time (Lamport)
Logical time (Lamport)
CSE 486/586 Distributed Systems Time and Synchronization
Logical time (Lamport)
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer Science & Engineering Department The Chinese University

© Chinese University, CSE Dept. Distributed Systems / Outline 1 Time 2 Coordination 3 Replication  The gossip architecture  The process groups approach 4 Summary

© Chinese University, CSE Dept. Distributed Systems / Time  The notation of time –story: 12/9/1949  External synchronization  Internal synchronization  Physical clocks and their synchronization  Logical time and logical clocks

© Chinese University, CSE Dept. Distributed Systems / Synchronizing Physical Clocks  Computer each contain their physical clock.  Physical clock is limited by its resolution - the period between updates of the clock register.  Clock drift often happens to physical clocks.  To compensate for clock drifts, computers are synchronized to a time service, e.g., UTC - Coordinated universal time.  Several other algorithms for synchronization.

© Chinese University, CSE Dept. Distributed Systems / Compensating for Clock Drift  S(t) = H(t) +  (t) ; S = application time, H = hardware clock time,  = compensating factor.  Assuming linear relation  (t) = aH(t) + b.  Let the value of the software clock be T skew when H = h, and let the actual time be T real.  If S is to give the actual time after N further ticks, we have T skew = (1 + a)h + b, and T real + N = (1 + a)(h + N) + b.  a = (T real - T skew ) / N and b = T skew - (1 + a)h

© Chinese University, CSE Dept. Distributed Systems / Cristian’s Clock Synchronization  Let the time returned in S ’s message m t be t. P should set its clock to t + T round / 2.  The time by S ’s clock when the reply message arrives is [ t + min, t + T round - min ], with width T round - 2 min and accuracy ±( T round / 2 - min ).

© Chinese University, CSE Dept. Distributed Systems / The Berkeley Algorithm  A coordinator computer is chosen to act as the master. Master periodically polls to slaves whose clocks are to be synchronized.  The master estimates their local clock times by observing the round-trip times, and it averages the values obtained.  The master takes a fault-tolerant average.  Should the master fail, then another can be elected to take over.

© Chinese University, CSE Dept. Distributed Systems / The Network Time Protocol  NTP distributes time information to provide: –a service to synchronize clients in Internet –a reliable service that survives loss of connection –a frequent resynchronization for client’s clock drift –protection against interference with time server  NTP service is provided by various servers: –Primary servers, secondary servers, and servers of other levels (called strata).  Synchronization subnet: the servers which are connected in a logical hierarchy.

© Chinese University, CSE Dept. Distributed Systems / NTP Synchronization Modes  Estimating delay and offset in NTP protocol: –a = T i-2 - T i-3 –b = T i –T i-1 –d i = a + b –o i = (a-b)/2  NTP servers synchronize in three modes: –Multicast mode –Procedure-call mode –Symmetric mode

© Chinese University, CSE Dept. Distributed Systems / Logical Time and Logical Clocks  The order of the events –two events occurred in the order they appear in a process. –event of sending occurred before event of receiving.  happened-before relation, denoted by  HB1: If  process p: x  p y, then x  y. HB2: For any message m, send(m)  rcv(m), HB3: If x, y and z are events such that x  y and y  z, then x  z.

© Chinese University, CSE Dept. Distributed Systems / Logical Timestamps Example  Events occurring at three processes

© Chinese University, CSE Dept. Distributed Systems / Logical Timestamps  Logical clock - a monotonically increasing software counter.  C p : logical clock for process p; C p (a): timestamp of event a at p; C(b): timestamp of event b  LC1: event issued at process p: C p := C p + 1 LC2: a) p sends message m to q with value t = C p b) C q := max(C q,t) and applies LC1 to rcv(m).  If a  b then C(a) < C(b), but not visa versa!  Total order logical clock and vector clock.

© Chinese University, CSE Dept. Distributed Systems / Logical Timestamps Example  Events occurring at three processes => 7

© Chinese University, CSE Dept. Distributed Systems / Coordination  Distributed processes need to coordinate their activities.  Distributed mutual exclusion is required for safety, liveness, and ordering properties.  Election algorithms: methods for choosing a unique process for a particular role.

© Chinese University, CSE Dept. Distributed Systems / Distributed Mutual Exclusion  The basic requirements for mutual exclusion: –ME1 (safety): At most one process may execute in the critical section (CS) at a time. –ME2 (liveness): A process requesting entry to the CS is eventually granted. –ME3 (ordering): Entry to the CS should be granted in happened-before order.  The central server algorithm.  A ring-based algorithm.  A distributed algorithm using logical clocks.

© Chinese University, CSE Dept. Distributed Systems / Elections  An election is a procedure carried out to choose a process from a group.  A ring-based election algorithm.  The bully algorithm.

© Chinese University, CSE Dept. Distributed Systems / Replication  Replication is the maintenance of on-line copies of data and resources  For performance, availability, fault tolerance.  Basic Architectural Model.  Consistency and request ordering.  The gossip architecture.  The process group approach.

© Chinese University, CSE Dept. Distributed Systems / Bulletin Board Example

© Chinese University, CSE Dept. Distributed Systems / Replication Issues  Replica management models consider trade- off between accuracy and response time. –Simple asynchronous model –Totally synchronous model –Quorum-based schemes –Causality-ordered  Multicast updates to a process group.  Read/write ratio.

© Chinese University, CSE Dept. Distributed Systems / Basic Architectural Model

© Chinese University, CSE Dept. Distributed Systems / The Gossip Architecture

© Chinese University, CSE Dept. Distributed Systems / The Primary Copy Model

© Chinese University, CSE Dept. Distributed Systems / Consistency and Request Ordering  Criteria: correctness vs. expenses.  Total, causal, and sync ordering requirements.  Implementing request ordering.  Implementing total ordering.  Implementing causal ordering with vector timestamps.

© Chinese University, CSE Dept. Distributed Systems / Total, Causal, and Sync Ordering  Let r 1 and r 2 be requests.  Total ordering: Either r 1 is processed before r 2 or r 2 is processed before r 1, at all RMs.  Causal ordering: If r 1 happened-before r 2 then r 1 is processed before r 2 at all RMs.  FIFO ordering: If r 1 is issued before r 2 then r 1 is processed before r 2 at all RMs.  Sync-ordering: If r 1 is sync-ordered, then either r 1 is processed before r 2 at all RMs or r 2 is processed before r 1 at all RMs.

© Chinese University, CSE Dept. Distributed Systems / Example 1

© Chinese University, CSE Dept. Distributed Systems / Example 2

© Chinese University, CSE Dept. Distributed Systems / Implementing Request Ordering  Hold-back: A received request is not processed by RM until ordering constraints can be met.  Stable message: all prior requests processed.  Hold-back queue vs. delivery queue.  Safety property: no message will be delivered out of order by being prematurely transferred.  Liveness property: no message should wait on the hold-back queue forever.

© Chinese University, CSE Dept. Distributed Systems / Implementing Total Ordering  Basic approach: assign totally ordered identifiers to requests.  Sequencer  Distributed agreement in assigning request ids.

© Chinese University, CSE Dept. Distributed Systems / Implementing Causal Ordering  Vector timestamp: a list of counts of update events, one for each of the replica managers.  Merging vector timestamps: choose the largest values from the two vectors, component-wise. e.g., FE time vector: (2,3,4)

© Chinese University, CSE Dept. Distributed Systems / The Gossip Architecture Query & Update Ops.Clients Communication via FE

© Chinese University, CSE Dept. Distributed Systems / Process Group Approach  Process group and group communication.  Group structure –peer group –server group –client-server group –subscription group –hierarchical groups

© Chinese University, CSE Dept. Distributed Systems / Process Group Services  Group membership management –Create –Join –Leave  Group address expansion  Multicast communication –unreliable multicast –reliable multicast –atomic multicast

© Chinese University, CSE Dept. Distributed Systems / Multicast Communication  Sample multicasting operation void Multicast (in orderType order, in groupId group, in msg m, in int nReplies, out msgSeq replies) raises (…);  Order types: –unordered –total ordering –causal ordering –sync-ordering

© Chinese University, CSE Dept. Distributed Systems / Summary  Timing issues –Synchronizing physical clocks. –Logical time and logical clocks.  Distributed coordination and mutual exclusions.  Replication to providing good performance, high availability and fault tolerance.  The gossip approach and the process group approach.  CORBA replication service is a research topic.