Distributed Systems. Time, Clocks, and Ordering of Events

Similar documents
Distributed Systems. Time, clocks, and Ordering of events. Rik Sarkar. University of Edinburgh Spring 2018

Distributed systems Lecture 4: Clock synchronisation; logical clocks. Dr Robert N. M. Watson

Clock Synchronization

Time in Distributed Systems: Clocks and Ordering of Events

Distributed Computing. Synchronization. Dr. Yingwu Zhu

Distributed Systems 8L for Part IB

DISTRIBUTED COMPUTER SYSTEMS

Time. To do. q Physical clocks q Logical clocks

Chapter 11 Time and Global States

Slides for Chapter 14: Time and Global States

Time is an important issue in DS

CS505: Distributed Systems

Agreement. Today. l Coordination and agreement in group communication. l Consensus

Clock Synchronization

Time. Today. l Physical clocks l Logical clocks

CS 425 / ECE 428 Distributed Systems Fall Indranil Gupta (Indy) Oct. 5, 2017 Lecture 12: Time and Ordering All slides IG

CS505: Distributed Systems

Distributed Systems Principles and Paradigms. Chapter 06: Synchronization

Distributed Systems Principles and Paradigms

Time. Lakshmi Ganesh. (slides borrowed from Maya Haridasan, Michael George)

Absence of Global Clock

7680: Distributed Systems

CS 347 Parallel and Distributed Data Processing

Clocks in Asynchronous Systems

416 Distributed Systems. Time Synchronization (Part 2: Lamport and vector clocks) Jan 27, 2017

Real-Time Course. Clock synchronization. June Peter van der TU/e Computer Science, System Architecture and Networking

Lecture 8: Time & Clocks. CDK: Sections TVS: Sections

Our Problem. Model. Clock Synchronization. Global Predicate Detection and Event Ordering

Recap. CS514: Intermediate Course in Operating Systems. What time is it? This week. Reminder: Lamport s approach. But what does time mean?

Distributed Systems Time and Global State

What is the Right Answer?

TTA and PALS: Formally Verified Design Patterns for Distributed Cyber-Physical

Time Synchronization

TSCCLOCK: A LOW COST, ROBUST, ACCURATE SOFTWARE CLOCK FOR NETWORKED COMPUTERS

Distributed Data Fusion with Kalman Filters. Simon Julier Computer Science Department University College London

A Methodology for Clock Benchmarking

Coordination. Failures and Consensus. Consensus. Consensus. Overview. Properties for Correct Consensus. Variant I: Consensus (C) P 1. v 1.

Logical Time. 1. Introduction 2. Clock and Events 3. Logical (Lamport) Clocks 4. Vector Clocks 5. Efficient Implementation

Do we have a quorum?

MODELING TIME AND EVENTS IN A DISTRIBUTED SYSTEM

Time Synchronization between SOKUIKI Sensor and Host Computer using Timestamps

Time, Clocks, and the Ordering of Events in a Distributed System

Bias Estimation in Asymmetric Packet-based Networks

Verification of clock synchronization algorithm (Original Welch-Lynch algorithm and adaptation to TTA)

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Consensus. One Reason: Impossibility of Consensus. Let s Consider This

DCS: Distributed Asynchronous Clock Synchronization in Delay Tolerant Networks

Agreement Protocols. CS60002: Distributed Systems. Pallab Dasgupta Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur

CORRECTNESS OF A GOSSIP BASED MEMBERSHIP PROTOCOL BY (ANDRÉ ALLAVENA, ALAN DEMERS, JOHN E. HOPCROFT ) PRATIK TIMALSENA UNIVERSITY OF OSLO

CS5412: REPLICATION, CONSISTENCY AND CLOCKS

Distributed Systems. 06. Logical clocks. Paul Krzyzanowski. Rutgers University. Fall 2017

arxiv: v1 [cs.dc] 22 Oct 2018

CS 188: Artificial Intelligence Fall 2008

General Naïve Bayes. CS 188: Artificial Intelligence Fall Example: Overfitting. Example: OCR. Example: Spam Filtering. Example: Spam Filtering

I Can t Believe It s Not Causal! Scalable Causal Consistency with No Slowdown Cascades

Say Kids, What Time Is It?

Causality and physical time

Modern Physics notes Paul Fendley Lecture 34. Born, chapter III (most of which should be review for you), chapter VII

Application Note #3413

Lecture 14: Secure Multiparty Computation

Byzantine Agreement. Gábor Mészáros. Tatracrypt 2012, July 2 4 Smolenice, Slovakia. CEU Budapest, Hungary

A Formal Model of Clock Domain Crossing and Automated Verification of Time-Triggered Hardware

5. Sequential Logic x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

Round-Efficient Perfectly Secure Message Transmission Scheme Against General Adversary

Socket Programming. Daniel Zappala. CS 360 Internet Programming Brigham Young University

Integrating External and Internal Clock Synchronization. Christof Fetzer and Flaviu Cristian. Department of Computer Science & Engineering

Interplay of security and clock synchronization"

Surveying Prof. Bharat Lohani Department of Civil Engineering Indian Institute of Technology, Kanpur

Distributed Systems Gossip Algorithms

More Relativity: The Train and The Twins

CSE 4201, Ch. 6. Storage Systems. Hennessy and Patterson

Energy-Efficient Broadcast Scheduling. Speed-Controlled Transmission Channels

High Performance Computing

CSE 123: Computer Networks

Today. Vector Clocks and Distributed Snapshots. Motivation: Distributed discussion board. Distributed discussion board. 1. Logical Time: Vector clocks

Lecture on Sensor Networks

Outline. EECS Components and Design Techniques for Digital Systems. Lec 18 Error Coding. In the real world. Our beautiful digital world.

Modeling and Simulation NETW 707

Lan Performance LAB Ethernet : CSMA/CD TOKEN RING: TOKEN

Accurate Event Composition

MODBUS Protocol for CS141 network card families

Chandy-Lamport Snapshotting

Shared Memory vs Message Passing

GPS Activities. You will be given some information about how far you are from three cities and your goal is to find your location.

Clock Synchronization with Bounded Global and Local Skew

Asymmetric Communication Complexity and Data Structure Lower Bounds

Part 1: correct application of derivative to formula for E points)'

-Electromagnetic. Waves - disturbance that propagates through space & time - usually with transfer of energy -Mechanical.

Time and Frequency Activities at the JHU Applied Physics Laboratory

Estimation of clock offset from one-way delay measurement on asymmetric paths

VLSI Physical Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Approximate Synchrony: An Abstraction for Distributed Time-Synchronized Systems

GNSS: Global Navigation Satellite Systems

Unit 4 Waves and Sound Waves and Their Properties

Implementation of the IEEE 1588 Precision Time Protocol for Clock Synchronization in the Radio Detection of Ultra-High Energy Neutrinos

Relativistic Effects

Finite-State Model Checking

A Logic of Authentication. Borrows, Abadi and Needham TOCS 1990, DEC-SRC 1989

CPU SCHEDULING RONG ZHENG

Simulation of the IEEE 1588 Precision Time Protocol in OMNeT++

Unreliable Failure Detectors for Reliable Distributed Systems

Transcription:

Distributed Systems Time, Clocks, and Ordering of Events Björn Franke University of Edinburgh 2016/2017

Today Last lecture: Basic Algorithms Today: Time, clocks, NTP Ref: CDK Causality, ordering, logical clocks: Ref: VG, CDK 2

Time Ordering of events are important: Which happened first Need synchronisation between sender and receiver Coordination of joint activity etc.. 3

Coordinated Universal Time Coordinated universal time (UTC) Time maintained for civil use (on atomic clock) Kept within 0.9 seconds of exact mean time for Greenwich 4

Clocks Piezoelectric effect: Squeeze a quartz crystal: generates electric field Apply electric field: crystal bends Quartz crystal clock: Resonation like a tuning fork Accurate to parts per million Gain/lose ½ second per day 5

Challenges Two clocks do not agree perfectly Skew: The time difference between two clocks Quartz oscillators vibrate at different rates Drift: The difference in rates of two clocks If we had two perfect clocks: Skew = 0 Drift = 0 6

When we detect a clock has a skew Eg: it is 5 seconds behind Or 5 seconds ahead What can we do? 7

When we detect a clock has a skew e.g. it is 5 seconds behind We can advance it 5 seconds to correct Might skip over event scheduled in-between Or 5 seconds ahead Pushing back 5 seconds is a bad idea Message was received before it was sent Document closed before it was saved etc.. We want monotonicity: time always increases We want continuity: time doesn t make jumps 8

When we detect a clock has a skew e.g. it is behind Run it faster until it catches up It is ahead Run it slower until it catches up This does not guarantee correct clock in future Need to check and adjust periodically 9

How clocks synchronise Obtain time from time server: Client Request time Time : 00:05:20 Server 10

How clocks synchronise Obtain time from time server: Request time Client Server Time : 00:05:20 Time is inaccurate Delays in message transmission Delays due to processing time Server s time may be inaccurate 11

Christian s algorithm Compensate for delays Request sent at T 0 Reply received at T 1 T server Request Reply T 0 T 1 Assume delays are symmetric 12

Christian s algorithm T new = T server + (T 1 T 0 )/2 T server Request Reply T 0 T 1 13

Christian s algorithm T server Request Reply T 0 T 1 T new = T server + (T 1 T 0 )/2 Example: T 0 = 5:05:08.100, T 1 = 5:05:9.500 T server = 5:05:9.100 T new = 5:05:09:800 14

Christian s algorithm If minimum message transit time T min is known Range = T 1 T 0-2T min Accuracy of result: (T 1 T 0-2T min )/2 T server Request Reply T 0 T 1 T min T min 15

Berkeley algorithm Assumes no machine has perfect time Takes average of participating computers Sync all clocks to average 16

Berkeley algorithm One computer is elected as server (master) Others are slaves Master polls each machine for time Compute average Key idea: average will cancel out skews Send each clock the offset by which it needs to adjust time Sending time itself is susceptible to network delays 17

Berkeley algorithm Fault tolerance Ignore readings of clocks with too large skews If master fails: run an election algorithm and a slave becomes master 18

Network time protocol (NTP) Enable clients to synchronise to UTC with reasonable accuracy Reliable: Redundant servers and paths Scalable: Enable many clients to synchronise frequently Security Authenticate sources 19

Network time protocol Servers in strata 1: directly connected to atomic, GPS etc clock May inter-communicate for cross checks 2: few microseconds of level 1 etc 20

Network time protocol Uses multiple rounds of messages to get better time Large number of servers Uses a multiple spanning tree (MST) for inter- server synchronisation 21

Time and Synchronisation Important topic in distributed systems Many different methods Depending on systems, requirements No perfect solution 22

Special Relativity Light cone: Things that e can have cause/influence e Things that could have caused/influenced e 23

GPS Satellites: Have very accurate atomic clocks Transmit signals: satid, time T 0, Receivers measure distance: (T 1 T 0 )*c [c = speed of light] Distance from multiple satellites gives location Complex computation, taking into account possible errors, clock drift and skew etc.. Needs relativistic computation Special relativity: Clocks on fast moving satellites run slow (microseconds per day drift for satellites) General relativity: Clocks far from heavy bodies run fast (microseconds per day) 24