Distributed Systems [Fall 2013]

Similar documents
Time and synchronization

Time and synchronization. ( There s never enough time )

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

Baseball Scorekeeping for First Timers

2018 BOYS BASEBALL RULES Revised 2/26/18

Sibley Diamond Classic

SCLL League Rules 2017

2018 FCYB Local Rules

MCCS SOP XX-02, Subj: YOUTH SPORTS PROGRAM

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

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

Game Guidelines- AA LEVEL

Local Little League Guidelines, Clarification, and Rules

Explanations

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

PUYALLUP PARKS & RECREATION YOUTH BASEBALL RULES

Williamsburg Youth Baseball League 2018 Rules

TTA Clarifications / Rule Changes

2018 SEASON: MINORS PALOS VERDES LITTLE LEAGUE LOCAL RULES

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

NORTHWEST SUBURBAN PALOMINO LEAGUE RULES 2015

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

Chesterfield Township and New Baltimore Parks & Recreation League Rules MINOR BASEBALL

Chesterfield Township Recreation Department League Rules MAJOR BASEBALL

MECHANICSVILLE LITTLE LEAGUE DIVISION PLAYING RULES ALL GENERAL RULES APPLY

Madisonville. Spring Baseball Rules 8 Year Old A. Field. a. Bases Bases will be 60 feet apart

Local Rules Addendum to Pony Official Rules and Regulations Book Pinto 7 Playing Rules

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

Road Data Input System using Digital Map in Roadtraffic

11. No person or player shall have any tobacco products on the field or in the dugouts during a game.

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

HCLL Scorekeeping Clinic

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

NORTH PENINSULA YOUTH BASEBALL

Milford Little League Pee Wee In-park Rules

Left Fielder. Homework

Delaware Township Athletics Association

CHAMPAIGN PARK DISTRICT SENIOR SOFTBALL RULES AND REGULATIONS

MECHANICSVILLE LITTLE LEAGUE DIVISION PLAYING RULES ALL GENERAL RULES APPLY

Youth Leagues Competition Rules

KINGS TOURNAMENTS. Hosted by Kings Sports, LLC Tournament Rules Updated 11/10/16 /16

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

Simulating Major League Baseball Games

ISCORE INTEGRATION IOS SCORING GUIDE

Mason Invitational Tournament

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

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

Lynn s Softball League Rules Mens 2018

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

Cisco SIP Proxy Server (CSPS) Compliance Information

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

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

Computer Scorekeeping Procedures Page 1

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

PROVO PARKS & RECREATION ADULT SOFTBALL LEAGUE

A One-Parameter Markov Chain Model for Baseball Run Production

Additional On-base Worth 3x Additional Slugging?

2018 Top Gun Baseball Rules

SENIOR BOYS BASEBALL

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

Unisys. Imagine it. Done. c Consulting. c Systems Integration. c Outsourcing. c Infrastructure. c Server Technology. Unisys NDP 30 and NDP 110

Stanislaus Girls Softball Association

Sp. Fork Russell Swenson Ball Park 300 South 300 West, Spanish Fork Payson Hillman Fields 1060 North Main Street, Payson

Beaver Bash Tournament Rules and Information

FYB/USSSA 2018 LOCAL TOURNAMENT RULES

Men s Baseball Rule Clarifications

2018 GGBL Rule Changes & GGBL Points of Emphasis. Chris Bullock GGBL President Tim Gaines GGBL Secretary Don Benken GGBL Commissioner

Common Umpire Rule Myths

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.

2015 Intermediate League MODIFIED RULES 9 thru 12 year-old League

NPYL Major Division Rules Boys 11 & 12 Years of Age Revised April 2015

TRUE or FALSE. Rules: 2.00 PERSON, TOUCH, STRIKE (e) and 6.05(f) 2. The batter-runner must turn to his right after over-running first base.

CARY GROVE YOUTH BASEBALL and SOFTBALL PONY LEAGUE RULES

Baseball and Softball

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

OFFICIALS EDUCATION PROGRAM BATTING

Des Plaines Youth Baseball

3 ROADWAYS 3.1 CMS ROADWAY NETWORK 3.2 TRAVEL-TIME-BASED PERFORMANCE MEASURES Roadway Travel Time Measures

2012 W.C.Y.A.A. Spring-Summer Rules

Updated: February 2017 (updated rules from February 2016 and February 2017 are in BOLD)

IFPAA League Rules (Mustang - 10-year olds)

Efficient Minimization of Routing Cost in Delay Tolerant Networks

MBSA Boys Pinto Rules

PSAA League Rules: Machine Pitch Revised: Spring 2012

Marysville Junior Baseball & Softball Association (MJBSA)

2015 OSAA Baseball Rules Clinic January 23, 2015

Top 40 Baseball Rule Myths

PSAA League Rules: Machine Pitch Revised Fall 2015

PIAA DISTRICT III M&T BANK BASEBALL CHAMPIONSHIP 2018 REGULATIONS

To find their sum, you could simply add from left to right, or you could pair the numbers as illustrated and add each pair.

CENTRAL CHESTERFIELD LITTLE LEAGUE White Sheet Rules & Points of Emphasis

Palos Baseball Organization 2018 Palos Rumble Tournament Rules

BUTLER COUNTY CAL RIPKEN ASSOCIATION 2018 INSTRUCTIONAL LEAGUE RULES

2. The Tournament Director(s) will be in charge of all aspects of the tournament. They will be the only contact during tournament play.

LZBSA Major League Rules (5 th & 6th Grade)

Dead Ball. For PIAA Baseball

WHEATON YOUTH BASEBALL COACH-PITCH SUPPLEMENTARY RULES

Discovering Special Triangles Learning Task

BOYS BASEBALL RULES

Druid Hills Youth Sports - Rules and Regulations. Updated February 2018

Transcription:

Distributed Systems [Fall 2013] Lec 7: Time and Synchronization Slide acks: Dave Andersen, Randy Bryant (http://www.cs.cmu.edu/~dga/15-440/f11/lectures/09-time+synch.pdf) 1

Any Questions for HW 2? Deadline is tomorrow before midnight! Poll: Where are you on HW 2? a) Largely done with both parts (maybe some testing left) b) Largely done with first part c) Done with neither part 2

Today s outline Distributed time A baseball example Synchronizing real clocks Cristian s algorithm The Berkeley Algorithm Network Time Protocol (NTP) Logical time Lamport logical clocks Vector clocks 3

Distributed Time 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 Examples: If two file servers get different update requests to same file, what should be the order of those requests? Did the runner get to home base before the pitcher was eliminated? 4

A Baseball Example Four locations: pitcher s mound (P), home plate, first base, and third base Ten events: e 1 : pitcher (P) throws ball toward home e 2 : ball arrives at home e 3 : batter (B) hits ball toward pitcher e 4 : batter runs toward first base e 5 : runner runs toward home e 6 : ball arrives at pitcher e 7 : pitcher throws ball toward first base e 8 : runner arrives at home e 9 : ball arrives at first base e 10 : batter arrives at first base 2 nd base 3 rd base 1 st base R P B home plate 5

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 6

Ways to Synchronize Send message from first base to home when ball arrives? Or both home and first base send messages to a central timekeeper when runner/ball arrives But: How long does this message take to arrive? Synchronize clocks before the game? Clocks drift One-in-a-million drifting => 1 second in 11 days Synchronize clocks continuously during the game? E.g.: NTP, GPS, etc. But how do these work? 7

Real-Clock Synchronization Suppose I want to synchronize the clocks on two machines (M1 and M2) One solution: M1 (sender) sends its own time T in message to M2 M2 (receiver) sets its time according to the message But what time should M2 set? 8

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 9

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 10

Synchronization in the Real World Real networks are asynchronous Propagation delays are arbitrary Real networks are unreliable Messages don t always arrive 11

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 12

The Berkeley Algorithm In Cristian s algorithm, how does sender know the right time? Master uses Cristian s algorithm to gather time from many clients Computes average time Discards outliers Sends time adjustments back to all clients 13

The Network Time Protocol (NTP) Uses a hierarchy of time servers Class 1 servers have accurate (and expensive) clocks connected directly to atomic clocks or GPS receivers Class 2 servers get time from Class 1 and Class 2 servers Class 3 servers get time from any server Client machines (e.g., your smartphones, laptops, desktops, or server machines) synchronize w/ time servers Synchronization similar to Cristian s alg. Accuracy: Local ~1ms, Global ~10ms 14

Real Synchronization Is Imperfect Clocks are never exactly synchronized Often inadequate for distributed systems Might need totally-ordered events But, more often than not, distributed systems do not need real time, but some time that every machine in a protocol agrees upon! E.g.: suppose file servers S1 and S2 receive two update requests, W1 and W2, for file F They need to apply W1 and W2 in the same order, but they may not really care precisely which order 15

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 16

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 17

is only a partial-order Concurrency Some events are unrelated Definition (concurrency): We say e is concurrent with e (written e e ) if neither e e nor e e 18

Back to Baseball Events: e 1 : pitcher (P) throws ball toward home e 2 : ball arrives at home e 3 : batter (B) hits ball toward pitcher e 4 : batter runs toward first base e 5 : runner runs toward home e 6 : ball arrives at pitcher e 7 : pitcher throws ball toward first base e 8 : runner arrives at home e 9 : ball arrives at first base e 10 : batter arrives at first base 19

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 20

Lamport Logical Clocks Lamport clock L assigns logical timestamps to events consistent with 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 21

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. When receiving 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) 22

Lamport on the baseball example Initializing each local clock to 0, we get L(e 1 ) = 1 (pitcher throws ball to home) L(e 2 ) = 2 (ball arrives at home) L(e 3 ) = 3 (batter hits ball to pitcher) L(e 4 ) = 4 L(e 5 ) = 1 L(e 6 ) = 4 L(e 7 ) = 5 L(e 8 ) = 5 L(e 9 ) = 6 (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! 23

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 24

Important Points Physical Clocks Can keep closely synchronized, but never perfect Logical Clocks Encode causality relationship Lamport clocks provide only one-way encoding 25