Time and synchronization

Similar documents
Time and synchronization. ( There s never enough time )

Distributed Systems [Fall 2013]

HCLL Scorekeeping Clinic

Explanations

CITY OF ANDERSON PARKS AND RECREATION DEPARTMENT 12 & Under Local League Rules Recreational Baseball League

Where are you right now? How fast are you moving? To answer these questions precisely, you

Williamsburg Youth Baseball League 2018 Rules

Fairfield National Little League AA Rules (updated: Spring 2014)

2018 BOYS BASEBALL RULES Revised 2/26/18

WEST UNIVERSITY LITTLE LEAGUE - TOURNAMENT RULES AND REGULATIONS: REVISED 7/24/ No tobacco use of any kind allowed on the premises.

Any team member may pitch, subject to the restrictions of the pitch count as recommended

1. The Ohio Hot Stove Baseball League Rules are to apply, unless SYB specifies the rule for league play.

SCLL League Rules 2017

ISCORE INTEGRATION IOS SCORING GUIDE

4. Game Time: Starting time is forfeit time, unless delay is created by Triple Crown. Game time starts at completion of the pre-game meeting.

Wake County Club Baseball League 2015 Varsity Rules and Regulations Last Revised March 1, 2015

MCCS SOP XX-02, Subj: YOUTH SPORTS PROGRAM

Baseball Scorekeeping for First Timers

CO-ED SOFTBALL RULES AND REGULATIONS

2018 SEASON: MINORS PALOS VERDES LITTLE LEAGUE LOCAL RULES

NAGAAA Ratings Definitions

MECHANICSVILLE LITTLE LEAGUE DIVISION PLAYING RULES ALL GENERAL RULES APPLY

2. Is a defensive timeout charged if the catcher goes out to the mound after an umpire or hitter is hit with a pitch or foul ball?

Pitch count example: A pitcher pitches 32 pitches on Monday. The pitcher must rest on Tuesday and will be eligible to pitch again on Wednesday.

developing athletes SPORTS RULES & REGULATIONS

DHYS Rules & Regulations Colt League Supplemental to PONY Baseball, Inc, Rules and Regulations Table of Contents

A One-Parameter Markov Chain Model for Baseball Run Production

Road Data Input System using Digital Map in Roadtraffic

Fairfield National Little League. AAA Rules (updated: Spring 2013)

There are three main pillars of behavior consistently found in successful baseball players and teams:

TEE BALL BASICS. Here is a field diagram: 45 feet

CHAIN-O-LAKES SOFTBALL LEAGUE 10U SOFTBALL RULES year olds. IHSA Softball Rules will apply with the following exceptions and clarifications:

2018 Red Land 7U Tournament Rules June 23 24, 2018

PROVO PARKS & RECREATION ADULT SOFTBALL LEAGUE

High School Baseball Pitching. Rule 6

Houston Architectural and Engineering Softball League Rules Last Updated: February 13, 2017

Simulating Major League Baseball Games

SOFTBALL STANDARDS GRADE LEVEL STANDARD DESCRIPTION PE.2.C.2.5 PE.2.C.2.9 PE.2.L.3.3 PE.3.M.1.7 PE.2.C.2.8 PE.3.L.3.3 PE.3.L.3.4 PE.3.L.4.

Sibley Diamond Classic

2019 Viera Suntree Little League Baseball & Softball In-House Rules

6U All Star Rules SECTION 14 6U RULES. (for complete set of rules visit the IFA/VTD rulebook online)

Minor League Rules Updated: 2018

Drost Park Khoury League Machine Pitch Division Rules Revised March 6, 2013

Wake County Club Baseball League 2018 Varsity Rules and Regulations Last Revised February 28, 2018

MECHANICSVILLE LITTLE LEAGUE DIVISION PLAYING RULES ALL GENERAL RULES APPLY

Gouwan Strike English Manual

Wake County Club Baseball League 2018 Junior Varsity Rules and Regulations Last Revised February 28, 2018

Men s Baseball Rule Clarifications

2013 WIFFLE BALL TOURNAMENT RULES

2018 FCYB Local Rules

MBSA Boys Pinto Rules

NORTH PENINSULA YOUTH BASEBALL

SABA Major League Rules vs. Official Little League Rules

UMPIRES MANUAL 2 AND 3 PERSON HIGH SCHOOL CREWS OREGON BASEBALL. update

IFPAA League Rules (Mustang - 10-year olds)

Introduction to Pattern Recognition

2015 OSAA Baseball Rules Clinic January 23, 2015

Game Guidelines- AA LEVEL

DIAMOND SIZE: Fifty foot (50 ) bases. Thirty-five foot (35 ) pitching rubber.

Overview: A) There will be four basic rotations 3 scenarios for each rotation including when an umpire goes out on the play.

Milford Little League Pee Wee In-park Rules

Spring 2018 PARK REC TEAMS T-BALL RULES

2018 Kimberly Sunset Summer Classic 13U Year Old Baseball Tournament Rules (Field dimensions: 60 pitching mound, 90 bases)

Local Little League Guidelines, Clarification, and Rules

Youth Leagues Competition Rules

TWO DIMENSIONAL KINEMATICS

Left Fielder. Homework

10U Girls Softball June 15-17, 2018 Westborough, MA

WBWS RULES ***Please note that once a division fills, late registrations will NOT be accepted.***

WHEATON PARK DISTRICT GIRLS SOFTBALL

YOUTH BASEBALL & SOFTBALL PROGRAM RULES AND REGULATIONS 2018

OUTFIELD POSITIONS CF LF RF

DLL Local Rules Single A Division. The current Little League Baseball rulebook will govern all play not specified below.

CO-ED SOFTBALL RULES AND REGULATIONS

ALLOUEZ PARKS & RECREATION DEPARTMENT 2015 Men's Summer Adult Softball League General Rules & Regulations

RULES WE NEED TO KNOW

2018 COED LEAGUE RULES

LITTLE LEAGUE RULE/REGULATION CHANGES FOR 2019 SEASON

Sports Force Parks Softball Tournament Rules

Sacred Heart CYO Baseball Minors 9 Rules

NCAA BASEBALL RULES CHANGES AND POINTS OF EMPHASIS JANUARY SEASON

BOYS BASEBALL RULES

Transit Signal Preemption and Priority Treatments

2018 6U (T-BALL) LEAGUE RULES

4.) Managers please have your players on the field and ready to play at the designated time and please pinch run for your catcher with 2 outs

NEW JERSEY STATE INTERSCHOLASTIC ATHLETIC ASSOCIATION 1161 Route 130 North, P.O. Box 487, Robbinsville, NJ Phone ~ Fax

LZBSA Minor League Rules (3 rd & 4 th grade)

2019 Little League Rule Changes and Clarifications

Redmond West Little League

2017 RYBL Mosquito-Midget House League Rules

NORTHWEST SUBURBAN PALOMINO LEAGUE RULES 2015

Coed Adult Kickball Rules

E.A.P. PROCESS Formulate the plan carefully

Project: OpenDRIVE Document No. Issue: Title: Style Guide For OpenDRIVE Databases VI C. Date: 05 th March 2014 no.

CHLL 11U and 12U Rules

THE CHIPPEWA VALLEY ROCK-N-ROLL KICKBALL CLASSIC Cinder City Park Altoona, WI * OFFICIAL RULES OF PLAY *

2017 International Baseball Tournament. Scorekeeping Hints

Westfield Youth Sports, Inc. Double A Baseball Rules

Presented by: Old Town Recreation Center

Beaver Bash Tournament Rules and Information

Transcription:

Time and synchronization ( There s never enough time ) Today s outline Global Time Time in distributed systems A baseball example Synchronizing real clocks Cristian s algorithm The Berkeley Algorithm Network Time Protocol (NTP) Logical time Lamport logical clocks Vector Clocks 1

Why Global Timing? Suppose there were a globally consistent time standard Would be handy Who got last seat on airplane? Who submitted final auction bid before deadline? Did defense move before snap? Time Standards UT1 Based on astronomical observations Greenwich Mean Time TAI Started Jan 1, 1958 Each second is 9,192,631,770 cycles of radiation emitted by Cesium atom Has diverged from UT1 due to slowing of earth s rotation UTC TAI + leap seconds to be within 800ms of UT1 Currently 35 Most recent: June 30, 2012 2

Comparing Time Standards UT1 UTC Distributed time Premise The notion of time is well-defined (and measurable) at each single location But the relationship between time at different locations is unclear Can minimize discrepancies, but never eliminate them Reality Stationary GPS receivers can get global time with < 1µs error Few systems designed to use this 3

A baseball example Four locations: pitcher s mound, first base, home plate, and third base Ten events: e 1 : pitcher throws ball to home e 2 : ball arrives at home e 3 : batter hits ball to pitcher e 4 : batter runs to first base e 5 : runner runs to home e 6 : ball arrives at pitcher e 7 : pitcher throws ball to first base e 8 : runner arrives at home e 9 : ball arrives at first base e 10 : batter arrives at first base A baseball example Pitcher knows e 1 happens before e 6, which happens before e 7 Home plate umpire knows e 2 is before e 3, which is before e 4, which is before e 8, Relationship between e 8 and e 9 is unclear 4

Ways to synchronize Send message from first base to home? Or to a central timekeeper How long does this message take to arrive? Synchronize clocks before the game? Clocks drift million to one => 1 second in 11 days Synchronize continuously during the game? GPS, pulsars, etc Perfect networks Messages always arrive, with propagation delay exactly d Sender sends time T in a message Receiver sets clock to T+d Synchronization is exact 5

Synchronous networks Messages always arrive, with propagation delay at most D Sender sends time T in a message Receiver sets clock to T + D/2 Synchronization error is at most D/2 Synchronization in the real world Real networks are asynchronous Propagation delays are arbitrary Real networks are unreliable Messages don t always arrive 6

Cristian s algorithm Request time, get reply Measure actual round-trip time d Sender s time was T between t 1 and t 2 Receiver sets time to T + d/2 Synchronization error is at most d/2 Can retry until we get a relatively small d The Berkeley algorithm Master uses Cristian s algorithm to get time from many clients Computes average time Can discard outliers Sends time adjustments back to all clients 7

The Network Time Protocol (NTP) Uses a hierarchy of time servers Class 1 servers have highly-accurate clocks connected directly to atomic clocks, etc. Class 2 servers get time from only Class 1 and Class 2 servers Class 3 servers get time from any server Synchronization similar to Cristian s alg. Modified to use multiple one-way messages instead of immediate round-trip Accuracy: Local ~1ms, Global ~10ms Real synchronization is imperfect Clocks never exactly synchronized Often inadequate for distributed systems might need totally-ordered events might need millionth-of-a-second precision 8

Logical time Capture just the happens before relationship between events Discard the infinitesimal granularity of time Corresponds roughly to causality Time at each process is well-defined Definition ( i ): We say e i e if e happens before e at process i Global logical time Definition ( ): We define e e using the following rules: Local ordering: e e if e i e for any process i Messages: send(m) receive(m) for any message m Transitivity: e e if e e and e e We say e happens before e if e e 9

Concurrency is only a partial-order Some events are unrelated Definition (concurrency): We say e is concurrent with e (written e e ) if neither e e nor e e The baseball example revisited e 1 e 2 by the message rule e 1 e 10, because e 1 e 2, by the message rule e 2 e 4, by local ordering at home plate e 4 e 10, by the message rule Repeated transitivity of the above relations e 8 e 9, because No application of the rules yields either e 8 e 9 or e 9 e 8 10

Lamport logical clocks Lamport clock L orders events consistent with logical happens before ordering If e e, then L(e) < L(e ) But not the converse L(e) < L(e ) does not imply e e Similar rules for concurrency L(e) = L(e ) implies e e (for distinct e,e ) e e does not imply L(e) = L(e ) i.e., Lamport clocks arbitrarily order some concurrent events Lamport s algorithm Each process i keeps a local clock, L i Three rules: 1. At process i, increment L i before each event 2. To send a message m at process i, apply rule 1 and then include the current local time in the message: i.e., send(m,l i ) 3. To receive a message (m,t) at process j, set L j = max(l j,t) and then apply rule 1 before time-stamping the receive event The global time L(e) of an event e is just its local time For an event e at process i, L(e) = L i (e) 11

Lamport on the baseball example Initializing each local clock to 0, we get L(e 1 ) = 1 L(e 2 ) = 2 L(e 3 ) = 3 L(e 4 ) = 4 L(e 5 ) = 1 L(e 6 ) = 4 L(e 7 ) = 5 L(e 8 ) = 5 L(e 9 ) = 6 (pitcher throws ball to home) (ball arrives at home) (batter hits ball to pitcher) (batter runs to first base) (runner runs to home) (ball arrives at pitcher) (pitcher throws ball to first base) (runner arrives at home) (ball arrives at first base) L(e 10 ) = 7 (batter arrives at first base) For our example, Lamport s algorithm says that the run scores! Total-order Lamport clocks Many systems require a total-ordering of events, not a partial-ordering Use Lamport s algorithm, but break ties using the process ID L(e) = M * L i (e) + i M = maximum number of processes 12

Vector Clocks Goal Want ordering that matches causality V(e) < V(e ) if and only if e e Method Label each event by vector V(e) [c 1, c 2, c n ] c i = # events in process i that causally precede e Vector Clock Algorithm Initially, all vectors [0,0,,0] For event on process i, increment own c i Label message sent with local vector When process j receives message with vector [d 1, d 2,, d n ]: Set local each local entry k to max(c k, d k ) Increment value of c j 13

Vector clocks on the baseball example Event Vector Action e 1 [1,0,0,0] pitcher throws ball to home e 2 [1,0,1,0] ball arrives at home e 3 [1,0,2,0] batter hits ball to pitcher e 4 [1,0,3,0] batter runs to first base) e 5 [0,0,0,1] runner runs to home e 6 [2,0,2,0] ball arrives at pitcher e 7 [3,0,2,0] pitcher throws ball to 1 st base e 8 [1,0,4,1] runner arrives at home e 9 [3,1,2,0] ball arrives at first base e 10 [3,2,3,0] batter arrives at first base Vector: [p,f,h,t] Important Points Physical Clocks Can keep closely synchronized, but never perfect Logical Clocks Encode causality relationship Lamport clocks provide only one-way encoding Vector clocks provide exact causality information 14