Physical clock synchronization

Slides:



Advertisements
Similar presentations
CS542 Topics in Distributed Systems Diganta Goswami.
Advertisements

Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Failure Detection The ping-ack failure detector in a synchronous system satisfies – A: completeness – B: accuracy – C: neither – D: both.
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.
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.
Computer Science 425 Distributed Systems CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.
CS 582 / CMPE 481 Distributed Systems
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
Hwajung Lee. Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down, should we care.
Lecture 12 Synchronization. EECE 411: Design of Distributed Software Applications Summary so far … A distributed system is: a collection of independent.
1 Synchronization Part 1 REK’s adaptation of Claypool’s adaptation of Tanenbaum’s Distributed Systems Chapter 5.
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)
Distributed Mutual Exclusion
Distributed Algorithms
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
UBI529 Distributed Algorithms 2. Time Synchronization in Distributed Systems.
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.
Hwajung Lee. Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down, should we care.
Program correctness The State-transition model A global states S  s 0 x s 1 x … x s m {s k = set of local states of process k} S0  S1  S2  Each state.
Time This powerpoint presentation has been adapted from: 1) sApr20.ppt.
Lecture 10 – Mutual Exclusion Distributed Systems.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down,
ITEC452 Distributed Computing Lecture 6 Mutual Exclusion Hwajung Lee.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are: 1. Resource sharing 2. Avoiding concurrent update on shared data 3. Controlling the.
Distributed Systems Topic 5: Time, Coordination and Agreement
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 12-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) October 4, 2012 Lecture 12 Mutual Exclusion.
Lecture 7- 1 CS 425/ECE 428/CSE424 Distributed Systems (Fall 2009) Lecture 7 Distributed Mutual Exclusion Section 12.2 Klara Nahrstedt.
Decentralized solution 1
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
Classifying fault-tolerance Masking tolerance. Application runs as it is. The failure does not have a visible impact. All properties (both liveness & safety)
Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: –Mutual exclusion.
Distributed Systems Lecture 5 Time and synchronization 1.
Proof of liveness: an example
Distributed Computing
Time and Synchronization
Time and Clock Primary standard = rotation of earth
Time and Global States Ali Fanian Isfahan University of Technology
Lecture 5 Time and synchronization
CSE 486/586 Distributed Systems Time and Synchronization
Distributed Mutex EE324 Lecture 11.
Time and Clock.
Logical time (Lamport)
湖南大学-信息科学与工程学院-计算机与科学系
Atomicity, Non-determinism, Fairness
Time and Clock.
Decentralized solution 1
Mutual Exclusion Problem Specifications
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
CSE 486/586 Distributed Systems Mutual Exclusion
Chapter 5 (through section 5.4)
CDK: Sections 11.1 – 11.4 TVS: Sections 6.1 – 6.2
Synchronization (2) – Mutual Exclusion
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
Logical time (Lamport)
Logical time (Lamport)
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
CSE 486/586 Distributed Systems Mutual Exclusion
CSE 486/586 Distributed Systems Time and Synchronization
Logical time (Lamport)
Hwajung Lee ITEC452 Distributed Computing Lecture 6 Mutual Exclusion Sequential and concurrent events. Understanding logical clocks and vector clocks.
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down, should we care about physical clock synchronization?

Classification Types of Synchronization External Synchronization Internal Synchronization Phase Synchronization Types of clocks Unbounded 0, 1, 2, 3, . . . Bounded 0,1, 2, . . . M-1, 0, 1, . . . Unbounded clocks are not realistic, but are easier to deal with in the design of algorithms. Real clocks are always bounded.

Terminologies What are these? Drift rate  Clock skew  Resynchronization interval R Max drift rate  implies: (1- ) ≤ dC/dt < (1+ ) Challenges (Drift is unavoidable) Accounting for propagation delay Accounting for processing delay Faulty clocks

Internal synchronization Step 1. Read every clock in the system. Step 2. Discard outliers and substitute them by the value of the local clock. Step 3. Update the clock using the average of these values. Berkeley Algorithm A simple averaging algorithm that guarantees mutual consistency |c(i) - c(j)| < 

Internal synchronization Lamport and Melliar-Smith’s averaging algorithm handles byzantine clocks too Assume n clocks, at most t are faulty Step 1. Read every clock in the system. Step 2. Discard outliers and substitute them by the value of the local clock. Step 3. Update the clock using the average of these values. Synchronization is maintained if n > 3t Why? Bad clock A faulty clocks exhibits 2-faced or byzantine behavior

Internal synchronization Lamport & Melliar-Smith’s algorithm (continued) The maximum difference between the averages computed by two non-faulty nodes is (3td / n) To keep the clocks synchronized, 3td / n < d So, 3t < n k B a d c l o c k s

Cristian’s method External Synchronization Client pulls data from a time server every R unit of time, where R <  / 2. For accuracy, clients must compute the round trip time (RTT), and compensate for this delay while adjusting their own clocks. (Too large RTT’s are rejected) Time server

Network Time Protocol (NTP) Tiered architecture Broadcast mode - least accurate Procedure call - medium accuracy Peer-to-peer mode - upper level servers use this for max accuracy Time server Level 0 Level 1 Level 1 Level 1 Level 2 Level 2 Level 2 The tree can reconfigure itself if some node fails.

P2P mode of NTP  = (T2 -T4 -T1 +T3) / 2 - (TPQ - TQP) / 2 Let Q’s time be ahead of P’s time by . Then T2 = T1 + TPQ +  T4 = T3 + TQP -  y = TPQ + TQP = T2 +T4 -T1 -T3 (RTT)  = (T2 -T4 -T1 +T3) / 2 - (TPQ - TQP) / 2 T2 T3 Q P T1 T4 x Between y/2 and -y/2 So, x- y/2 ≤  ≤ x+ y/2 Ping several times, and obtain the smallest value of y. Use it to calculate 

Problems with Clock adjustment 1. What problems can occur when a clock value is Advanced from 171 to 174? 2. What problems can occur when a clock value is Moved back from 180 to 175? 1.What happened to the instant 172 and 173? 2. The instants 175 -180 appear twice

Mutual Exclusion CS p0 CS p1 p2 CS CS p3

Why mutual exclusion? Some applications are: Resource sharing Avoiding concurrent update on shared data Controlling the grain of atomicity Medium Access Control in Ethernet Collision avoidance in wireless broadcasts

Specifications ME1. At most one process in the CS. (Safety property) ME2. No deadlock. (Safety property) ME3. Every process trying to enter its CS must eventually succeed. This is called progress. (Liveness property) Progress is quantified by the criterion of bounded waiting. It measures a form of fairness by answering the question: Between two consecutive CS trips by one process, how many times other processes can enter the CS? There are many solutions, both on the shared memory model and the message-passing model

Message passing solution: Centralized decision making Client do true  send request; reply received  enter CS; send release; <other work> od server busy: boolean queue release req Server do request received and not busy  send reply; busy:= true request received and busy  enqueue sender release received and queue is empty  busy:= false release received and queue not empty  send reply to the head of the queue od reply clients

Comments - Centralized solution is simple. - But the server is a single point of failure. This is BAD. - ME1-ME3 is satisfied, but FIFO fairness is not guaranteed. Why? Can we do better? Yes!

Decentralized solution 1: Lamport’s algorithm {Life of each process} 1. Broadcast a timestamped request to all. Request received  enqueue sender in local Q;. Not in CS  send ack In CS  postpone sending ack (until exit from CS). 3. Enter CS, when (i) You are at the head of your own local Q (ii) You have received ack from all processes 4. To exit from the CS, (i) Delete the request from Q, and (ii) Broadcast a timestamped release 5. Release received  remove sender from local Q. Completely connected topology Can you show that it satisfies all the properties (i.e. ME1, ME2, ME3) of a correct solution?