Verteilte Systeme (Distributed Systems)

Size: px
Start display at page:

Download "Verteilte Systeme (Distributed Systems)"

Transcription

1 Verteilte Systeme (Distributed Systems) Karl M. Göschka VerteilteSysteme/

2 Lecture 6: Clocks and Agreement Synchronization of physical clocks Logical clocks and ordering Distributed mutual exclusion Election Global state

3 Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time. Time is so basic to the way people think! 3

4 Physical Clocks (1) Computation of the mean solar day. 4

5 Time and Clocks Historically, time has been measured astronomically: Solar day (transit of the sun) and solar second as 1/86400 of a solar day Earth s rotation is not constant (core turbulence) and slowing down (tidal friction, atmospheric drag) mean solar second (GMT) transitions of Cesium 133 International Atomic Time (TAI) at the BIH Coordinated Universal Time (UTC): UTC second = TAI second, but leap seconds keep UTC in phase with solar time 5

6 Physical Clocks (2) TAI solar second leap second UTC TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep UTC in phase with the sun. 6

7 Timer A timer is a counter that counts clock ticks Crystal oszillator Battery backed CMOS RAM (initial setting) Clock offset, skew, drift (different definitions in literature!) UTC is provided e.g. by National Institute of Standard Time (NIST): WWV, GEOS, GPS,... Real-time systems need actual clock time synchronize with real-world time (external) synchronize with each other (internal) 7

8 Clock Synchronization Algorithms The relation between clock time and UTC ticking at different rates. Maximum drift rate determines required re-synchronization interval. 8

9 Network Time Protocol (1) T 2 =T 2 -θ T 3 =T 3 -θ Getting the current time from a time server. 9

10 Network Time Protocol (2) Time must never run backward All nodes adjust (advance/slow down) their clocks locally Estimate/measure propagation delay Estimate offset and compute accuracy Take best (minimum delay) of eight measures Use multiple sources to improve accuracy Hierarchical precision (strata) ~ms (WAN), ~µs (LAN), ~ns (with hardware support, e.g., IEEE 1588) Security? 10

11 Network Time Protocol (3) Stratum 0 Stratum 1 Stratum 2 Stratum 3 NTP precision levels 11

12 Attacking time synchronization 12

13 The Berkeley Algorithm a) The time daemon asks all the other machines for their clock values b) The machines answer c) The time daemon tells everyone how to adjust their clock 14

14 Clock Synchronization in Wireless (1) e.g., sensor networks nodes are resource constrained multihop routing is expensive optimize algorithms for energy consumption RBS Reference Broadcast Synchronization internal sync (no absolute clock) only receivers synchronize (based on receipt of reference message) signal propagation time ~ constant (without multihop routing) 15

15 Clock Synchronization in Wireless (2) The usual critical path in determining network delays. The critical path in the case of RBS. 16

16 Lecture 6: Clocks and Agreement Synchronization of physical clocks Logical clocks and ordering Distributed mutual exclusion Election Global state

17 Time vs. Order (logical time) Synchronous system: Algorithms are easier to model, but clock synchronization needed Asynchronous system: Today s reality, but many design problems can not be solved with deterministic algorithms However, often no global clock and no clock synchronization are needed: It is sufficient to agree on the order of events (logical clocks) time is relative, anyway Then, some events are ordered, some are concurrent (partial order) 19

18 Making clocks move forward This situation must be prevented Fixed! In many cases, wall clock time does not matter. All we care about is relative time. (L. Lamport) (This is not true in some real-time systems.) 20

19 Happened-before (1) Definition of logical clocks based on the happened-before relation to order events sequentially in a distributed system: Events in one process are ordered (local clock) Message send happens before message receive happened-before is transitive Events that are not ordered are concurrent (partial ordering) Similar to physical causality, therefore also called potential causal ordering 21

20 Happened-before (2) p 1 a b m 1 p 2 c d m 2 Physical time p 3 e Feynman (space-time) diagrams document causality Relationship is transitive: a happened-before f Imposes a partial order (not total): a b c d f e (a,b,c,d), but e f f 22

21 Logical clock implementation Captures happened-before ordering numerically Lamport timestamps Each node keeps a counter (LC): 1. Increment LC before each event (computation, send, receive) 2. On message send, piggyback LC 3. On message receive set local LC to max(local LC, Received LC) (time can only move forward) and then apply rule 1 for receipt (+1). Total order by adding process ID a b L(a) < L(b), but the converse is not true! 23

22 Lamport clocks in middleware The positioning of Lamport s logical clocks in distributed systems. 24

23 Example: Inconsistent replication Problem due to message delays and lack of global time If (non-commutative) updates arrive in different orders at the two sites, the databases will become inconsistent. We could require all messages to arrive at all nodes in the same order (Which may be too strong also see causal). 25

24 Synchronizing multicast messages Assume data is replicated on several servers Updates to data are performed by clients Update request is multicast to all servers Multicast messages arrive in different orders at different servers How to ensure consistency of data at all servers? Order message deliveries at servers Differentiate between receipt and delivery 26

25 Totally-Ordered Multicast clients multicast their updates with (Lamport) timestamp (FIFO, reliable) upon receipt, the message is put into local queue ordered by timestamp server acknowledges receipt of requests by multicast (for total ordering) eventually all processes will have the same copy of the local queue a message that is at the head of the queue and has been acknowledged by all processes is delivered to server process (respective ACKs are deleted) updates may not be done in correct (?) order but they are done in the same order at all nodes 31

26 Vector Clocks - Principle Logical clocks order related events; nothing can be said about unrelated events Problem with Lamport timestamps: L(a)<L(b) > a b Rather: L(a)<L(b) (a b) or (a b) too restrictive? Concurrent message transmission using logical clocks. 32

27 Vector Clocks - Example (1,0,0) (2,0,0) p 1 a b m 1 p 2 (2,1,0) (2,2,0) c d m 2 Physical time p 3 (0,0,1) e f (2,2,2) 33

28 Vector Clocks - Algorithm 1. Initially, V i [j]=0 2. Before P i timestamps an event, V i [i]:=v i [i]+1 3. P i includes V i in every message it sends 4. When P i receives a timestamp t in a message, it sets V i [j]:=max(v i [j],t[j]) (merge operation), and then applies rule 2 for receipt. 34

29 Vector Clocks Usage V i [i] is the number of events P i has timestamped V i [j] (j i) is the number of events occurred at P j on which P i may causally depend Comparison of vector clocks: V=V iff V[j]=V [j] j V V iff V[j] V [j] j V<V iff V V and V V Now, V(a)<V(b) a b (and vice-versa) Disadvantage: more storage and message payload optimizations exist 35

30 Causal ordering using vector timestamps P1 (0,0,0) (0,1,0) (0,1,1) (0,2,1) P2 (0,0,0) (0,1,0) (0,1,1) (0,2,1) P3 (0,0,0) (0,1,0) (0,1,1) 39

31 Lecture 6: Clocks and Agreement Synchronization of physical clocks Logical clocks and ordering Distributed mutual exclusion Election Global state

32 Mutual Exclusion Coordinate activities, share resources critical section (monitor, semaphor) locally assisted by OS in turn assisted by HW in order to guarantee atomic operations Distributed mutex: based solely on message passing: Safety: At most one process may execute in the critical section at a time Liveness: Requests to enter and exit the critical section eventually succeed (no deadlock, no starvation) Ordering: Happened-before (fairness) 42

33 A Centralized Algorithm a) Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b) Process 2 then asks permission to enter the same critical region. The coordinator does not reply. c) When process 1 exits the critical region, it tells the coordinator, which then replies to 2 43

34 A Distributed Algorithm a) Two processes want to enter the same critical region at the same moment. They each multicast their intention along with timestamp. b) Process 0 has the lowest timestamp, so it wins. c) When process 0 is done, it sends an OK also, so 2 can now enter the critical region. 45

35 A Token Ring Algorithm a) An unordered group of processes on a network. b) A logical ring constructed in software: Token goes around ring; a process that owns the token can enter the critical region. 46

36 A dezentralized probabilistic Algorithm Each resource replicated n times Access requires majority m>n/2 Application in DHTs Coordinator may reset (forget) what if k=2m-n coordinators fail (i.e., (n-m)+k=m)? Voting correctness violated, but probability extremely low (e.g., ) Scales well (non-deterministic) BUT: Bad utilization if many competing nodes (starvation) 48

37 A Comparison of the Four Algorithms A comparison of four mutual exclusion algorithms. 49

38 Lecture 6: Clocks and Agreement Synchronization of physical clocks Logical clocks and ordering Distributed mutual exclusion Election Global state

39 Election algorithms in distributed systems Distributed agreement algorithms attempt to establish agreement among a set of processes about the value of a piece of information (e.g. what time is it?) Election algorithms are one group of agreement algorithms The problem is for a set of processes (participants) to elect a leader (e.g. who will be our coordinator?) Useful for many algorithms that require a (temporarily central) co-ordinator 51

40 The Bully Algorithm (1) a) Process 4 holds an election b) Process 5 and 6 respond, telling 4 to stop c) Now 5 and 6 each hold an election 52

41 The Bully Algorithm (2) d) Process 6 tells 5 to stop e) Process 6 wins and tells everyone by sending a COORDINATOR message 53

42 A Ring Algorithm Election algorithm using a ring. Organize the processes logically along a ring. 56

43 Another Ring Algorithm Note: The election was started by process 17. The highest process identifier encountered so far is 24. Participant processes are shown darkened 58

44 Elections in Ad hoc networks best leader is elected overlay is constructed (hierarchy) resource capacities are taken into account (e.g., battery lifetime) see example 60

45 Elections in Wireless Environments (1) Election algorithm in a wireless network, with node a as the source. (a) Initial network. (b) (e) The build-tree phase 61

46 Elections in Wireless Environments (2) Election algorithm in a wireless network, with node a as the source. (a) Initial network. (b) (e) The build-tree phase 62

47 Elections in Wireless Environments (3) (e) The build-tree phase. (f) Reporting of best node to source. 63

48 Elections in large-scale P2P Systems Requirements for superpeer selection: 1. Normal nodes should have low-latency access to superpeers. 2. Superpeers should be evenly distributed across the overlay network. 3. There should be a predefined portion of superpeers relative to the total number of nodes in the overlay network. 4. Each superpeer should not need to serve more than a fixed number of normal nodes. 64

49 Lecture 6: Clocks and Agreement Synchronization of physical clocks Logical clocks and ordering Distributed mutual exclusion Election Global state

50 Global state predicates (1) p 1 p 2 a. Garbage collection object reference message garbage object state of communication channel! p1 wait-for p 2 b. Deadlock wait-for state of communication channel! p1 p 2 c. Termination passive activate passive 66

51 Global state: Consistent cut a) A consistent cut b) An inconsistent cut (effect without cause) 67

52 Global state predicates (2) Stability once the system enters a state S 0 in which the predicate is true, it remains true in all future states reachable from S 0 Safety α is an undesirable predicate of the system s global state (e.g. being deadlocked) Safety(α) at S 0 : α=false for all states reachable from S 0 (i.e. bad α will never happen) Liveness β is a desirable property (e.g. reach termination) Lifeness(β) at S 0 : For any linearization starting from S 0 β=true for some state S L reachable from S 0 (i.e. good β will eventually happen) 68

53 Snapshot algorithm (1) Chandy and Lamport (1985): Record a set of process and channel states such that the recorded global state is consistent, even though the combination of recorded states may never have actually occurred at the same time. a) Organization of a process and channels for a distributed snapshot 69

54 Snapshot algorithm (3) b) Process Q receives a marker for the first time (from other channel) and records its local state c) Q records all incoming message d) Q receives a marker for its incoming channel and finishes recording the state of the incoming channel 71

55 Example (1) p c 1 2 p 2 c 1 Process P 2 has already received an order for five widgets before S 0 $1000 (none) account widgets $ account widgets 1. Global state S 0 <$1000, 0> p 1 c 2 (empty) p 2 <$50, 2000> c 1 (empty) 2. Global state S 1 <$900, 0> p 1 c 2 (Order 10, $100), M p 2 <$50, 2000> c 1 (empty) 3. Global state S 2 <$900, 0> p 1 c 2 (Order 10, $100), M p 2 <$50, 1995> c 1 (five widgets) M 4. Global state S 3 <$900, 5> p 1 c 2 (Order 10, $100) p 2 <$50, 1995> Final state: P1 <$1000,0>; P2<$50,1995>; c1<five widgets>; c2<> c 1 (empty) (M = marker message) 72

56 Reachability between states actual execution e 0,e 1,... S init recording begins recording ends S final S snap pre-snap: e' 0,e' 1,...e' R-1 post-snap: e' R,e' R+1,... if a stable predicate is true in the snapshot, then it is also true in (any) final state. 75

57 Summary Distributed processes need to synchronize their actions to ensure cooperation or fair competition Lack of a global clock makes synchronization difficult Often, ordering is enough: Logical clocks and vector stamps reduce the cost of synchronization Distributed agreement algorithms are required when processes need to coordinate their actions. Mutex, Election, Global state,... 77

Chapter 6 Synchronization

Chapter 6 Synchronization DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 6 Synchronization Clock Synchronization Figure 6-1. When each machine has its own clock, an event

More information

CSE 5306 Distributed Systems. Synchronization

CSE 5306 Distributed Systems. Synchronization CSE 5306 Distributed Systems Synchronization 1 Synchronization An important issue in distributed system is how processes cooperate and synchronize with one another Cooperation is partially supported by

More information

Clock Synchronization. Synchronization. Clock Synchronization Algorithms. Physical Clock Synchronization. Tanenbaum Chapter 6 plus additional papers

Clock Synchronization. Synchronization. Clock Synchronization Algorithms. Physical Clock Synchronization. Tanenbaum Chapter 6 plus additional papers Clock Synchronization Synchronization Tanenbaum Chapter 6 plus additional papers Fig 6-1. In a distributed system, each machine has its own clock. When this is the case, an event that occurred after another

More information

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech Advanced Topics in Distributed Systems Dr. Ayman A. Abdel-Hamid Computer Science Department Virginia Tech Synchronization (Based on Ch6 in Distributed Systems: Principles and Paradigms, 2/E) Synchronization

More information

CSE 5306 Distributed Systems

CSE 5306 Distributed Systems CSE 5306 Distributed Systems Synchronization Jia Rao http://ranger.uta.edu/~jrao/ 1 Synchronization An important issue in distributed system is how process cooperate and synchronize with one another Cooperation

More information

Last Class: Naming. Today: Classical Problems in Distributed Systems. Naming. Time ordering and clock synchronization (today)

Last Class: Naming. Today: Classical Problems in Distributed Systems. Naming. Time ordering and clock synchronization (today) Last Class: Naming Naming Distributed naming DNS LDAP Lecture 12, page 1 Today: Classical Problems in Distributed Systems Time ordering and clock synchronization (today) Next few classes: Leader election

More information

Distributed Coordination 1/39

Distributed Coordination 1/39 Distributed Coordination 1/39 Overview Synchronization of distributed processes requires new concepts in addition to synchronization of processes in single multi-core systems. Topics: Notion of global

More information

Distributed Synchronization. EECS 591 Farnam Jahanian University of Michigan

Distributed Synchronization. EECS 591 Farnam Jahanian University of Michigan Distributed Synchronization EECS 591 Farnam Jahanian University of Michigan Reading List Tanenbaum Chapter 5.1, 5.4 and 5.5 Clock Synchronization Distributed Election Mutual Exclusion Clock Synchronization

More information

SYNCHRONIZATION. DISTRIBUTED SYSTEMS Principles and Paradigms. Second Edition. Chapter 6 ANDREW S. TANENBAUM MAARTEN VAN STEEN

SYNCHRONIZATION. DISTRIBUTED SYSTEMS Principles and Paradigms. Second Edition. Chapter 6 ANDREW S. TANENBAUM MAARTEN VAN STEEN DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN واحد نجف آباد Chapter 6 SYNCHRONIZATION Dr. Rastegari - Email: rastegari@iaun.ac.ir - Tel: +98331-2291111-2488

More information

Synchronization Part 1. REK s adaptation of Claypool s adaptation of Tanenbaum s Distributed Systems Chapter 5

Synchronization Part 1. REK s adaptation of Claypool s adaptation of Tanenbaum s Distributed Systems Chapter 5 Synchronization Part 1 REK s adaptation of Claypool s adaptation of Tanenbaum s Distributed Systems Chapter 5 1 Outline! Clock Synchronization! Clock Synchronization Algorithms! Logical Clocks! Election

More information

Synchronization. Clock Synchronization

Synchronization. Clock Synchronization Synchronization Clock Synchronization Logical clocks Global state Election algorithms Mutual exclusion Distributed transactions 1 Clock Synchronization Time is counted based on tick Time judged by query

More information

Synchronization. Chapter 5

Synchronization. Chapter 5 Synchronization Chapter 5 Clock Synchronization In a centralized system time is unambiguous. (each computer has its own clock) In a distributed system achieving agreement on time is not trivial. (it is

More information

Synchronization. Distributed Systems IT332

Synchronization. Distributed Systems IT332 Synchronization Distributed Systems IT332 2 Outline Clock synchronization Logical clocks Election algorithms Mutual exclusion Transactions 3 Hardware/Software Clocks Physical clocks in computers are realized

More information

Last Class: Clock Synchronization. Today: More Canonical Problems

Last Class: Clock Synchronization. Today: More Canonical Problems Last Class: Clock Synchronization Logical clocks Vector clocks Global state Lecture 12, page 1 Today: More Canonical Problems Distributed snapshot and termination detection Election algorithms Bully algorithm

More information

殷亚凤. Synchronization. Distributed Systems [6]

殷亚凤. Synchronization. Distributed Systems [6] Synchronization Distributed Systems [6] 殷亚凤 Email: yafeng@nju.edu.cn Homepage: http://cs.nju.edu.cn/yafeng/ Room 301, Building of Computer Science and Technology Review Protocols Remote Procedure Call

More information

Clock-Synchronisation

Clock-Synchronisation Chapter 2.7 Clock-Synchronisation 1 Content Introduction Physical Clocks - How to measure time? - Synchronisation - Cristian s Algorithm - Berkeley Algorithm - NTP / SNTP - PTP IEEE 1588 Logical Clocks

More information

PROCESS SYNCHRONIZATION

PROCESS SYNCHRONIZATION DISTRIBUTED COMPUTER SYSTEMS PROCESS SYNCHRONIZATION Dr. Jack Lange Computer Science Department University of Pittsburgh Fall 2015 Process Synchronization Mutual Exclusion Algorithms Permission Based Centralized

More information

2. Time and Global States Page 1. University of Freiburg, Germany Department of Computer Science. Distributed Systems

2. Time and Global States Page 1. University of Freiburg, Germany Department of Computer Science. Distributed Systems 2. Time and Global States Page 1 University of Freiburg, Germany Department of Computer Science Distributed Systems Chapter 3 Time and Global States Christian Schindelhauer 12. May 2014 2. Time and Global

More information

Clock and Time. THOAI NAM Faculty of Information Technology HCMC University of Technology

Clock and Time. THOAI NAM Faculty of Information Technology HCMC University of Technology Clock and Time THOAI NAM Faculty of Information Technology HCMC University of Technology Using some slides of Prashant Shenoy, UMass Computer Science Chapter 3: Clock and Time Time ordering and clock synchronization

More information

Time Synchronization and Logical Clocks

Time Synchronization and Logical Clocks Time Synchronization and Logical Clocks CS 240: Computing Systems and Concurrency Lecture 5 Mootaz Elnozahy Today 1. The need for time synchronization 2. Wall clock time synchronization 3. Logical Time

More information

Time in Distributed Systems

Time in Distributed Systems Time Slides are a variant of slides of a set by Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13- 239227-5 Time in Distributed

More information

Synchronisation in. Distributed Systems. Co-operation and Co-ordination in. Distributed Systems. Kinds of Synchronisation. Clock Synchronization

Synchronisation in. Distributed Systems. Co-operation and Co-ordination in. Distributed Systems. Kinds of Synchronisation. Clock Synchronization Co-operation and Co-ordination in Distributed ystems Naming for searching communication partners Communication Mechanisms for the communication process ynchronisation in Distributed ystems But... Not enough

More information

OUTLINE. Introduction Clock synchronization Logical clocks Global state Mutual exclusion Election algorithms Deadlocks in distributed systems

OUTLINE. Introduction Clock synchronization Logical clocks Global state Mutual exclusion Election algorithms Deadlocks in distributed systems Chapter 5 Synchronization OUTLINE Introduction Clock synchronization Logical clocks Global state Mutual exclusion Election algorithms Deadlocks in distributed systems Concurrent Processes Cooperating processes

More information

Distributed Operating Systems. Distributed Synchronization

Distributed Operating Systems. Distributed Synchronization 2 Distributed Operating Systems Distributed Synchronization Steve Goddard goddard@cse.unl.edu http://www.cse.unl.edu/~goddard/courses/csce855 1 Synchronization Coordinating processes to achieve common

More information

Distributed Systems. coordination Johan Montelius ID2201. Distributed Systems ID2201

Distributed Systems. coordination Johan Montelius ID2201. Distributed Systems ID2201 Distributed Systems ID2201 coordination Johan Montelius 1 Coordination Coordinating several threads in one node is a problem, coordination in a network is of course worse: failure of nodes and networks

More information

Coordination 1. To do. Mutual exclusion Election algorithms Next time: Global state. q q q

Coordination 1. To do. Mutual exclusion Election algorithms Next time: Global state. q q q Coordination 1 To do q q q Mutual exclusion Election algorithms Next time: Global state Coordination and agreement in US Congress 1798-2015 Process coordination How can processes coordinate their action?

More information

Distributed Systems COMP 212. Lecture 17 Othon Michail

Distributed Systems COMP 212. Lecture 17 Othon Michail Distributed Systems COMP 212 Lecture 17 Othon Michail Synchronisation 2/29 What Can Go Wrong Updating a replicated database: Customer (update 1) adds 100 to an account, bank employee (update 2) adds 1%

More information

Chapter 6 Synchronization (2)

Chapter 6 Synchronization (2) DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 6 Synchronization (2) Plan Clock synchronization in distributed systems Physical clocks Logical

More information

UNIT IV 1. What is meant by hardware and software clock? Clock devices can be programmed to generate interrupts at regular intervals in orders that, for example, time slicing can be implemented.the operating

More information

Last Class: Naming. DNS Implementation

Last Class: Naming. DNS Implementation Last Class: Naming Naming Distributed naming DNS LDAP Lecture 12, page 1 DNS Implementation An excerpt from the DNS database for the zone cs.vu.nl. Lecture 10, page 2 X.500 Directory Service OSI Standard

More information

CMPSCI 677 Operating Systems Spring Lecture 14: March 9

CMPSCI 677 Operating Systems Spring Lecture 14: March 9 CMPSCI 677 Operating Systems Spring 2014 Lecture 14: March 9 Lecturer: Prashant Shenoy Scribe: Nikita Mehra 14.1 Distributed Snapshot Algorithm A distributed snapshot algorithm captures a consistent global

More information

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University CS 555: DISTRIBUTED SYSTEMS [LOGICAL CLOCKS] Shrideep Pallickara Computer Science Colorado State University Frequently asked questions from the previous class survey What happens in a cluster when 2 machines

More information

Distributed Systems. Clock Synchronization: Physical Clocks. Paul Krzyzanowski

Distributed Systems. Clock Synchronization: Physical Clocks. Paul Krzyzanowski Distributed Systems Clock Synchronization: Physical Clocks Paul Krzyzanowski pxk@cs.rutgers.edu Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution

More information

Chapter 6 Synchronization (1)

Chapter 6 Synchronization (1) DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 6 Synchronization (1) With material from Ken Birman Tanenbaum & Van Steen, Distributed Systems:

More information

Lecture 7: Logical Time

Lecture 7: Logical Time Lecture 7: Logical Time 1. Question from reviews a. In protocol, is in- order delivery assumption reasonable? i. TCP provides it b. In protocol, need all participants to be present i. Is this a reasonable

More information

Lecture 10: Clocks and Time

Lecture 10: Clocks and Time 06-06798 Distributed Systems Lecture 10: Clocks and Time Distributed Systems 1 Time service Overview requirements and problems sources of time Clock synchronisation algorithms clock skew & drift Cristian

More information

Lecture 12: Time Distributed Systems

Lecture 12: Time Distributed Systems Lecture 12: Time Distributed Systems Behzad Bordbar School of Computer Science, University of Birmingham, UK Lecture 12 1 Overview Time service requirements and problems sources of time Clock synchronisation

More information

Lecture 6: Logical Time

Lecture 6: Logical Time Lecture 6: Logical Time 1. Question from reviews a. 2. Key problem: how do you keep track of the order of events. a. Examples: did a file get deleted before or after I ran that program? b. Did this computers

More information

Distributed Systems. 05. Clock Synchronization. Paul Krzyzanowski. Rutgers University. Fall 2017

Distributed Systems. 05. Clock Synchronization. Paul Krzyzanowski. Rutgers University. Fall 2017 Distributed Systems 05. Clock Synchronization Paul Krzyzanowski Rutgers University Fall 2017 2014-2017 Paul Krzyzanowski 1 Synchronization Synchronization covers interactions among distributed processes

More information

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016 Distributed Systems 2016 Exam 1 Review Paul Krzyzanowski Rutgers University Fall 2016 Question 1 Why does it not make sense to use TCP (Transmission Control Protocol) for the Network Time Protocol (NTP)?

More information

CSE 486/586 Distributed Systems

CSE 486/586 Distributed Systems CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo CSE 486/586 Recap: Consensus On a synchronous system There s an algorithm that works. On

More information

DISTRIBUTED MUTEX. EE324 Lecture 11

DISTRIBUTED MUTEX. EE324 Lecture 11 DISTRIBUTED MUTEX EE324 Lecture 11 Vector Clocks Vector clocks overcome the shortcoming of Lamport logical clocks L(e) < L(e ) does not imply e happened before e Goal Want ordering that matches causality

More information

Time in Distributed Systems

Time in Distributed Systems in Distributed Systems There is no common universal time (Einstein) but the speed of light is constant for all observers irrespective of their velocity event e2 at earth time t2 ---- large distances ----

More information

TIME ATTRIBUTION 11/4/2018. George Porter Nov 6 and 8, 2018

TIME ATTRIBUTION 11/4/2018. George Porter Nov 6 and 8, 2018 TIME George Porter Nov 6 and 8, 2018 ATTRIBUTION These slides are released under an Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Creative Commons license These slides incorporate

More information

Distributed Systems Synchronization

Distributed Systems Synchronization Distributed Systems Synchronization Gianpaolo Cugola Dipartimento di Elettronica e Informazione Politecnico, Italy cugola@elet.polimi.it http://home.dei.polimi.it/cugola http://corsi.dei.polimi.it/distsys

More information

Time. COS 418: Distributed Systems Lecture 3. Wyatt Lloyd

Time. COS 418: Distributed Systems Lecture 3. Wyatt Lloyd Time COS 418: Distributed Systems Lecture 3 Wyatt Lloyd Today 1. The need for time synchronization 2. Wall clock time synchronization 3. Logical Time: Lamport Clocks 2 A distributed edit-compile workflow

More information

Failure Tolerance. Distributed Systems Santa Clara University

Failure Tolerance. Distributed Systems Santa Clara University Failure Tolerance Distributed Systems Santa Clara University Distributed Checkpointing Distributed Checkpointing Capture the global state of a distributed system Chandy and Lamport: Distributed snapshot

More information

Time Synchronization and Logical Clocks

Time Synchronization and Logical Clocks Time Synchronization and Logical Clocks CS 240: Computing Systems and Concurrency Lecture 5 Marco Canini Credits: Michael Freedman and Kyle Jamieson developed much of the original material. Today 1. The

More information

Verteilte Systeme/Distributed Systems Ch. 5: Various distributed algorithms

Verteilte Systeme/Distributed Systems Ch. 5: Various distributed algorithms Verteilte Systeme/Distributed Systems Ch. 5: Various distributed algorithms Holger Karl Computer Networks Group Universität Paderborn Goal of this chapter Apart from issues in distributed time and resulting

More information

ICT 6544 Distributed Systems Lecture 7

ICT 6544 Distributed Systems Lecture 7 ICT 6544 Distributed Systems Lecture 7 Hossen Asiful Mustafa Structured Naming Name Spaces (1) Figure 5-9. A general naming graph with a single root node. Name Spaces (2) Figure 5-10. The general organization

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED COORDINATION/MUTUAL EXCLUSION] Shrideep Pallickara Computer Science Colorado State University L22.1 Frequently asked questions from the previous

More information

Synchronization Part 2. REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17

Synchronization Part 2. REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17 Synchronization Part 2 REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17 1 Outline Part 2! Clock Synchronization! Clock Synchronization Algorithms!

More information

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED COORDINATION/MUTUAL EXCLUSION] Shrideep Pallickara Computer Science Colorado State University

More information

DISTRIBUTED REAL-TIME SYSTEMS

DISTRIBUTED REAL-TIME SYSTEMS Distributed Systems Fö 11/12-1 Distributed Systems Fö 11/12-2 DISTRIBUTED REAL-TIME SYSTEMS What is a Real-Time System? 1. What is a Real-Time System? 2. Distributed Real Time Systems 3. Predictability

More information

Distributed Systems Exam 1 Review Paul Krzyzanowski. Rutgers University. Fall 2016

Distributed Systems Exam 1 Review Paul Krzyzanowski. Rutgers University. Fall 2016 Distributed Systems 2015 Exam 1 Review Paul Krzyzanowski Rutgers University Fall 2016 1 Question 1 Why did the use of reference counting for remote objects prove to be impractical? Explain. It s not fault

More information

Process Synchroniztion Mutual Exclusion & Election Algorithms

Process Synchroniztion Mutual Exclusion & Election Algorithms Process Synchroniztion Mutual Exclusion & Election Algorithms Paul Krzyzanowski Rutgers University November 2, 2017 1 Introduction Process synchronization is the set of techniques that are used to coordinate

More information

Homework #2 Nathan Balon CIS 578 October 31, 2004

Homework #2 Nathan Balon CIS 578 October 31, 2004 Homework #2 Nathan Balon CIS 578 October 31, 2004 1 Answer the following questions about the snapshot algorithm: A) What is it used for? It used for capturing the global state of a distributed system.

More information

Distributed Systems Question Bank UNIT 1 Chapter 1 1. Define distributed systems. What are the significant issues of the distributed systems?

Distributed Systems Question Bank UNIT 1 Chapter 1 1. Define distributed systems. What are the significant issues of the distributed systems? UNIT 1 Chapter 1 1. Define distributed systems. What are the significant issues of the distributed systems? 2. What are different application domains of distributed systems? Explain. 3. Discuss the different

More information

Algorithms and protocols for distributed systems

Algorithms and protocols for distributed systems Algorithms and protocols for distributed systems We have defined process groups as having peer or hierarchical structure and have seen that a coordinator may be needed to run a protocol such as 2PC. With

More information

Coordination and Agreement

Coordination and Agreement Coordination and Agreement Nicola Dragoni Embedded Systems Engineering DTU Informatics 1. Introduction 2. Distributed Mutual Exclusion 3. Elections 4. Multicast Communication 5. Consensus and related problems

More information

CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED MUTUAL EXCLUSION] Frequently asked questions from the previous class survey

CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED MUTUAL EXCLUSION] Frequently asked questions from the previous class survey CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED MUTUAL EXCLUSION] Shrideep Pallickara Computer Science Colorado State University L23.1 Frequently asked questions from the previous class survey

More information

Last Class: Clock Synchronization. Today: More Canonical Problems

Last Class: Clock Synchronization. Today: More Canonical Problems Last Class: Clock Synchronization Logical clocks Vector clocks Global state Lecture 11, page 1 Today: More Canonical Problems Distributed snapshot and termination detection Election algorithms Bully algorithm

More information

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University

CS455: Introduction to Distributed Systems [Spring 2018] Dept. Of Computer Science, Colorado State University CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [DISTRIBUTED MUTUAL EXCLUSION] Frequently asked questions from the previous class survey Yes. But what really is a second? 1 second ==time for a cesium 133 atom

More information

Distributed Coordination! Distr. Systems: Fundamental Characteristics!

Distributed Coordination! Distr. Systems: Fundamental Characteristics! Distributed Coordination! What makes a system distributed?! Time in a distributed system! How do we determine the global state of a distributed system?! Event ordering! Mutual exclusion! Reading: Silberschatz,

More information

CSE 380 Computer Operating Systems

CSE 380 Computer Operating Systems CSE 380 Computer Operating Systems Instructor: Insup Lee University of Pennsylvania Fall 2003 Lecture Note: Distributed Systems 1 Introduction to Distributed Systems Why do we develop distributed systems?

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distributed Systems Principles and Paradigms Chapter 05 (version 16th May 2006) Maarten van Steen Vrije Universiteit Amsterdam, Faculty of Science Dept. Mathematics and Computer Science Room R4.20. Tel:

More information

Distributed Systems. Rik Sarkar James Cheney Global State & Distributed Debugging February 3, 2014

Distributed Systems. Rik Sarkar James Cheney Global State & Distributed Debugging February 3, 2014 Distributed Systems Rik Sarkar James Cheney Global State & Distributed Debugging Global State: Consistent Cuts The global state is the combination of all process states and the states of the communication

More information

Replication in Distributed Systems

Replication in Distributed Systems Replication in Distributed Systems Replication Basics Multiple copies of data kept in different nodes A set of replicas holding copies of a data Nodes can be physically very close or distributed all over

More information

Important Lessons. A Distributed Algorithm (2) Today's Lecture - Replication

Important Lessons. A Distributed Algorithm (2) Today's Lecture - Replication Important Lessons Lamport & vector clocks both give a logical timestamps Total ordering vs. causal ordering Other issues in coordinating node activities Exclusive access to resources/data Choosing a single

More information

Fault Tolerance Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University

Fault Tolerance Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University Fault Tolerance Part II CS403/534 Distributed Systems Erkay Savas Sabanci University 1 Reliable Group Communication Reliable multicasting: A message that is sent to a process group should be delivered

More information

6.852: Distributed Algorithms Fall, Class 12

6.852: Distributed Algorithms Fall, Class 12 6.852: Distributed Algorithms Fall, 2009 Class 12 Today s plan Weak logical time and vector timestamps Consistent global snapshots and stable property detection. Applications: Distributed termination.

More information

Parallel and Distributed Systems. Programming Models. Why Parallel or Distributed Computing? What is a parallel computer?

Parallel and Distributed Systems. Programming Models. Why Parallel or Distributed Computing? What is a parallel computer? Parallel and Distributed Systems Instructor: Sandhya Dwarkadas Department of Computer Science University of Rochester What is a parallel computer? A collection of processing elements that communicate and

More information

Synchronization (contd.)

Synchronization (contd.) Outline Synchronization (contd.) http://net.pku.edu.cn/~course/cs501/2008 Hongfei Yan School of EECS, Peking University 3/17/2008 Mutual Exclusion Permission-based Token-based Election Algorithms The Bully

More information

Self Stabilization. CS553 Distributed Algorithms Prof. Ajay Kshemkalyani. by Islam Ismailov & Mohamed M. Ali

Self Stabilization. CS553 Distributed Algorithms Prof. Ajay Kshemkalyani. by Islam Ismailov & Mohamed M. Ali Self Stabilization CS553 Distributed Algorithms Prof. Ajay Kshemkalyani by Islam Ismailov & Mohamed M. Ali Introduction There is a possibility for a distributed system to go into an illegitimate state,

More information

Arranging lunch value of preserving the causal order. a: how about lunch? meet at 12? a: <receives b then c>: which is ok?

Arranging lunch value of preserving the causal order. a: how about lunch? meet at 12? a: <receives b then c>: which is ok? Lamport Clocks: First, questions about project 1: due date for the design document is Thursday. Can be less than a page what we re after is for you to tell us what you are planning to do, so that we can

More information

Mutual Exclusion. A Centralized Algorithm

Mutual Exclusion. A Centralized Algorithm Mutual Exclusion Processes in a distributed system may need to simultaneously access the same resource Mutual exclusion is required to prevent interference and ensure consistency We will study three algorithms

More information

Coordination 2. Today. How can processes agree on an action or a value? l Group communication l Basic, reliable and l ordered multicast

Coordination 2. Today. How can processes agree on an action or a value? l Group communication l Basic, reliable and l ordered multicast Coordination 2 Today l Group communication l Basic, reliable and l ordered multicast How can processes agree on an action or a value? Modes of communication Unicast 1ç è 1 Point to point Anycast 1è

More information

Selected Questions. Exam 2 Fall 2006

Selected Questions. Exam 2 Fall 2006 Selected Questions Exam 2 Fall 2006 Page 1 Question 5 The clock in the clock tower in the town of Chronos broke. It was repaired but now the clock needs to be set. A train leaves for the nearest town,

More information

Distributed systems. Lecture 6: distributed transactions, elections, consensus and replication. Malte Schwarzkopf

Distributed systems. Lecture 6: distributed transactions, elections, consensus and replication. Malte Schwarzkopf Distributed systems Lecture 6: distributed transactions, elections, consensus and replication Malte Schwarzkopf Last time Saw how we can build ordered multicast Messages between processes in a group Need

More information

Three Models. 1. Time Order 2. Distributed Algorithms 3. Nature of Distributed Systems1. DEPT. OF Comp Sc. and Engg., IIT Delhi

Three Models. 1. Time Order 2. Distributed Algorithms 3. Nature of Distributed Systems1. DEPT. OF Comp Sc. and Engg., IIT Delhi DEPT. OF Comp Sc. and Engg., IIT Delhi Three Models 1. CSV888 - Distributed Systems 1. Time Order 2. Distributed Algorithms 3. Nature of Distributed Systems1 Index - Models to study [2] 1. LAN based systems

More information

Distributed Systems. Pre-Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2015

Distributed Systems. Pre-Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2015 Distributed Systems Pre-Exam 1 Review Paul Krzyzanowski Rutgers University Fall 2015 October 2, 2015 CS 417 - Paul Krzyzanowski 1 Selected Questions From Past Exams October 2, 2015 CS 417 - Paul Krzyzanowski

More information

Dep. Systems Requirements

Dep. Systems Requirements Dependable Systems Dep. Systems Requirements Availability the system is ready to be used immediately. A(t) = probability system is available for use at time t MTTF/(MTTF+MTTR) If MTTR can be kept small

More information

Introduction to Distributed Systems Seif Haridi

Introduction to Distributed Systems Seif Haridi Introduction to Distributed Systems Seif Haridi haridi@kth.se What is a distributed system? A set of nodes, connected by a network, which appear to its users as a single coherent system p1 p2. pn send

More information

Proseminar Distributed Systems Summer Semester Paxos algorithm. Stefan Resmerita

Proseminar Distributed Systems Summer Semester Paxos algorithm. Stefan Resmerita Proseminar Distributed Systems Summer Semester 2016 Paxos algorithm stefan.resmerita@cs.uni-salzburg.at The Paxos algorithm Family of protocols for reaching consensus among distributed agents Agents may

More information

Large Systems: Design + Implementation: Communication Coordination Replication. Image (c) Facebook

Large Systems: Design + Implementation: Communication Coordination Replication. Image (c) Facebook Large Systems: Design + Implementation: Image (c) Facebook Communication Coordination Replication Credits Slides largely based on Distributed Systems, 3rd Edition Maarten van Steen Andrew S. Tanenbaum

More information

PART B UNIT II COMMUNICATION IN DISTRIBUTED SYSTEM PART A

PART B UNIT II COMMUNICATION IN DISTRIBUTED SYSTEM PART A CS6601 DISTRIBUTED SYSTEMS QUESTION BANK UNIT 1 INTRODUCTION 1. What is a distributed system? 2. Mention few examples of distributed systems. 3. Mention the trends in distributed systems. 4. What are backbones

More information

Process groups and message ordering

Process groups and message ordering Process groups and message ordering If processes belong to groups, certain algorithms can be used that depend on group properties membership create ( name ), kill ( name ) join ( name, process ), leave

More information

Exam 2 Review. Fall 2011

Exam 2 Review. Fall 2011 Exam 2 Review Fall 2011 Question 1 What is a drawback of the token ring election algorithm? Bad question! Token ring mutex vs. Ring election! Ring election: multiple concurrent elections message size grows

More information

Distributed Mutual Exclusion

Distributed Mutual Exclusion Distributed Mutual Exclusion Mutual Exclusion Well-understood in shared memory systems Requirements: at most one process in critical section (safety) if more than one requesting process, someone enters

More information

Availability versus consistency. Eventual Consistency: Bayou. Eventual consistency. Bayou: A Weakly Connected Replicated Storage System

Availability versus consistency. Eventual Consistency: Bayou. Eventual consistency. Bayou: A Weakly Connected Replicated Storage System Eventual Consistency: Bayou Availability versus consistency Totally-Ordered Multicast kept replicas consistent but had single points of failure Not available under failures COS 418: Distributed Systems

More information

Distributed Systems. Lec 9: Distributed File Systems NFS, AFS. Slide acks: Dave Andersen

Distributed Systems. Lec 9: Distributed File Systems NFS, AFS. Slide acks: Dave Andersen Distributed Systems Lec 9: Distributed File Systems NFS, AFS Slide acks: Dave Andersen (http://www.cs.cmu.edu/~dga/15-440/f10/lectures/08-distfs1.pdf) 1 VFS and FUSE Primer Some have asked for some background

More information

Distributed Systems (5DV147)

Distributed Systems (5DV147) Distributed Systems (5DV147) Mutual Exclusion and Elections Fall 2013 1 Processes often need to coordinate their actions Which rocess gets to access a shared resource? Has the master crashed? Elect a new

More information

CS 417: the one-hour study guide for exam 2

CS 417: the one-hour study guide for exam 2 CS 417: the one-hour study guide for exam 2 Disclaimer: This study guide attempts to touch upon the most important topics that may be covered on the exam but does not claim to necessarily cover everything

More information

2017 Paul Krzyzanowski 1

2017 Paul Krzyzanowski 1 Question 1 What problem can arise with a system that exhibits fail-restart behavior? Distributed Systems 06. Exam 1 Review Stale state: the system has an outdated view of the world when it starts up. Not:

More information

Michel Raynal. Distributed Algorithms for Message-Passing Systems

Michel Raynal. Distributed Algorithms for Message-Passing Systems Michel Raynal Distributed Algorithms for Message-Passing Systems Contents Part I Distributed Graph Algorithms 1 Basic Definitions and Network Traversal Algorithms... 3 1.1 DistributedAlgorithms... 3 1.1.1

More information

CSE 124: TIME SYNCHRONIZATION, CRISTIAN S ALGORITHM, BERKELEY ALGORITHM, NTP. George Porter October 27, 2017

CSE 124: TIME SYNCHRONIZATION, CRISTIAN S ALGORITHM, BERKELEY ALGORITHM, NTP. George Porter October 27, 2017 CSE 124: TIME SYNCHRONIZATION, CRISTIAN S ALGORITHM, BERKELEY ALGORITHM, NTP George Porter October 27, 2017 ATTRIBUTION These slides are released under an Attribution-NonCommercial-ShareAlike 3.0 Unported

More information

Distributed Systems Coordination and Agreement

Distributed Systems Coordination and Agreement Distributed Systems Coordination and Agreement Allan Clark School of Informatics University of Edinburgh http://www.inf.ed.ac.uk/teaching/courses/ds Autumn Term 2012 Coordination and Agreement Overview

More information

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS.

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS. TRANSACTIONS Transaction: DISTRIBUTED SYSTEMS [COMP94] Comes from database world Defines a sequence of operations Atomic in presence of multiple clients and failures Slide Lecture 5: Synchronisation and

More information

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS.

DISTRIBUTED SYSTEMS [COMP9243] Lecture 5: Synchronisation and Coordination (Part 2) TRANSACTION EXAMPLES TRANSACTIONS. TRANSACTIONS Transaction: DISTRIBUTED SYSTEMS [COMP94] Comes from database world Defines a sequence of operations Atomic in presence of multiple clients and failures Slide Lecture 5: Synchronisation and

More information

Consistency in Distributed Systems

Consistency in Distributed Systems Consistency in Distributed Systems Recall the fundamental DS properties DS may be large in scale and widely distributed 1. concurrent execution of components 2. independent failure modes 3. transmission

More information