SynchronizationCS-4513, D-Term 20071 Synchronization in Distributed Systems CS-4513 D-Term 2007 (Slides include materials from Operating System Concepts,

Slides:



Advertisements
Similar presentations
CS 542: Topics in Distributed Systems Diganta Goswami.
Advertisements

CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
1 Chapter 3. Synchronization. STEMPusan National University STEM-PNU 2 Synchronization in Distributed Systems Synchronization in a single machine Same.
Distributed Computing
Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at University.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
Synchronization in Distributed Systems
Distributed Systems Spring 2009
CS 582 / CMPE 481 Distributed Systems
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
More on Replication and Consistency CS-4513, D-Term More on Replication and Consistency CS-4513 D-Term 2007 (Slides include materials from Operating.
1. Explain why synchronization is so important in distributed systems by giving an appropriate example When each machine has its own clock, an event that.
Synchronization Clock Synchronization Logical Clocks Global State Election Algorithms Mutual Exclusion.
Election AlgorithmsCS-4513 D-term Election Algorithms CS-4513 Distributed Computing Systems (Slides include materials from Operating System Concepts,
CS603 Process Synchronization February 11, Synchronization: Basics Problem: Shared Resources –Generally data –But could be others Approaches: –Model.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
Replication and Consistency CS-4513 D-term Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials from Operating.
Synchronization in Distributed Systems CS-4513 D-term Synchronization in Distributed Systems CS-4513 Distributed Computing Systems (Slides include.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
Clock Synchronization and algorithm
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Lecture 12 Synchronization. EECE 411: Design of Distributed Software Applications Summary so far … A distributed system is: a collection of independent.
Synchronization Chapter 5. Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned.
More on Replication and Consistency CS-4513 D-term More on Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
1 Synchronization Part 1 REK’s adaptation of Claypool’s adaptation of Tanenbaum’s Distributed Systems Chapter 5.
Election Algorithms. Topics r Issues r Detecting Failures r Bully algorithm r Ring algorithm.
Synchronization.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Distributed Mutex EE324 Lecture 11.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 6 Synchronization.
Election AlgorithmsCS-4513, D-Term Synchronization (continued) CS-4513 D-Term 2007 (Slides include materials from Operating System Concepts, 7 th.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
Synchronization Chapter 5.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Lecture 10 – Mutual Exclusion Distributed Systems.
Real-Time & MultiMedia Lab Synchronization Distributed System Jin-Seung,KIM.
Distributed Process Coordination Presentation 1 - Sept. 14th 2002 CSE Spring 02 Group A4:Chris Sun, Min Fang, Bryan Maden.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Page 1 Mutual Exclusion & Election Algorithms Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content.
6 SYNCHRONIZATION. introduction processes synchronize –exclusive access. –agree on the ordering of events much more difficult compared to synchronization.
Synchronization. Clock Synchronization In a centralized system time is unambiguous. In a distributed system agreement on time is not obvious. When each.
Synchronization in Distributed Systems Chapter 6.3.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
CS3771 Today: Distributed Coordination  Previous class: Distributed File Systems Issues: Naming Strategies: Absolute Names, Mount Points (logical connection.
Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: –Mutual exclusion.
Lecture 11: Coordination and Agreement Central server for mutual exclusion Election – getting a number of processes to agree which is “in charge” CDK4:
Distributed Computing
Distributed Mutex EE324 Lecture 11.
Chapter 6.3 Mutual Exclusion
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Outline Distributed Mutual Exclusion Introduction Performance measures
Lecture 10: Coordination and Agreement
Prof. Leonardo Mostarda University of Camerino
Lecture 11: Coordination and Agreement
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

SynchronizationCS-4513, D-Term Synchronization in Distributed Systems CS-4513 D-Term 2007 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne, Modern Operating Systems, 2 nd ed., by Tanenbaum, and Distributed Systems: Principles & Paradigms, 2 nd ed. By Tanenbaum and Van Steen)

SynchronizationCS-4513, D-Term Issue Synchronization within one system is hard enough Semaphores Messages Monitors … Synchronization among processes in a distributed system is much harder

SynchronizationCS-4513, D-Term Example File locking in NFS Not supported directly within NFS v.3 Need lockmanager service to supplement NFS

SynchronizationCS-4513, D-Term What about using Time? make recompiles if foo.c is newer than foo.o Scenario make on machine A to build foo.o Test on machine B; find and fix a bug in foo.c Re-run make on machine B Nothing happens! Why?

SynchronizationCS-4513, D-Term Synchronizing Time on Distributed Computers See Tanenbaum & Van Steen, §6.1.1, for descriptions of Solar Time International Atomic Time GPS, etc. §6.1.3 for Clock Synchronization algorithms

SynchronizationCS-4513, D-Term NTP (Network Time Protocol) A requests time of B at its own T 1 B receives request at its T 2, records B responds at its T 3, sending values of T 2 and T 3 A receives response at its T 4 Question: what is  = T B – T A ? A B T1T1 T2T2 T3T3 T4T4

SynchronizationCS-4513, D-Term NTP (Network Time Protocol) Question: what is  = T B – T A ? Assume transit time is approximately the same both ways A B T1T1 T2T2 T3T3 T4T4

SynchronizationCS-4513, D-Term NTP (continued) Servers organized as strata –Stratum 0 server adjusts itself to WWV directly –Stratum 1 adjusts self to Stratum 0 servers –Etc. Within a stratum, servers adjust with each other

SynchronizationCS-4513, D-Term Adjusting the Clock If T A is slow, add  to clock rate To speed it up gradually If T A is fast, subtract  from clock rate To slow it down gradually

SynchronizationCS-4513, D-Term Berkeley Algorithm Time Daemon polls other systems Computes average time Tells other machines how to adjust their clocks

SynchronizationCS-4513, D-Term Problem Time not a reliable method of synchronization Users mess up clocks (and forget to set their time zones!) Unpredictable delays in Internet Relativistic issues If A and B are far apart physically, and two events T A and T B are very close in time, then which comes first? how do you know?

SynchronizationCS-4513, D-Term Example At midnight PDT, bank posts interest to your account based on current balance. At 3:00 AM EDT, you withdraw some cash. Does interest get paid on the cash you just withdrew? Depends upon which event came first! What if transactions made on different replicas?

SynchronizationCS-4513, D-Term Example (continued)

SynchronizationCS-4513, D-Term Solution — Logical Clocks Not “clocks” at all Just monotonic counters Lamport’s temporal logic Definition: a  b means a occurs before b I.e., all processes agree that a happens, then later b happens E.g., send(message)  receive(message)

SynchronizationCS-4513, D-Term Logical Clocks (continued)

SynchronizationCS-4513, D-Term Logical Clocks (continued) Every machine maintains its own logical “clock” C Transmit C with every message If C received > C own, then adjust C own forward to C received + 1 Result: Anything that is known to follow something else in logical time has larger logical clock value.

SynchronizationCS-4513, D-Term Logical Clocks (continued)

SynchronizationCS-4513, D-Term Variations See Tanenbaum & Van Steen, §6.2 Note: Grapevine timestamps for updating its registries behave somewhat like logical clocks.

SynchronizationCS-4513, D-Term Mutual Exclusion in Distributed Systems Prevent inconsistent usage or updates to shared data Two approaches Token Permission

SynchronizationCS-4513, D-Term Centralized Permission Approach One process is elected coordinator for a resource All others ask permission. Possible responses –Okay; denied (ask again later); none (caller waits)

SynchronizationCS-4513, D-Term Centralized Permissions (continued) Advantages –Mutual exclusion guaranteed by coordinator –“Fair” sharing possible without starvation –Simple to implement Disadvantages –Single point of failure (coordinator crashes) –Performance bottleneck –…–…

SynchronizationCS-4513, D-Term Decentralized Permissions n coordinators; ask all E.g., n replicas Must have agreement of m > n/2 Advantage No single point of failure Disadvantage Lots of messages Really messy

SynchronizationCS-4513, D-Term Distributed Permissions Use Lamport’s logical clocks Requestor sends reliable messages to all other processes (including self) Waits for OK replies from all other processes Replying process If not interested in resource, reply OK If currently using resource, queue request, don’t reply If interested, then reply OK if requestor is earlier Queue request if requestor is later

SynchronizationCS-4513, D-Term Distributed Permissions (continued) Process 0 and Process 2 want resource Process 1 replies OK because not interested Process 0 has lower time-stamp, thereby goes first …

SynchronizationCS-4513, D-Term Distributed Permissions (continued) Advantage –No central bottleneck –Fewer messages than Decentralized Disadvantage –n points of failure –i.e., failure of one node to respond locks up system

SynchronizationCS-4513, D-Term Token system Organize processes in logical ring Each process knows successor Token is passed around ring If process is interested in resource, it waits for token Releases token when done If node is dead, process skips over it Passes token to successor of dead process

SynchronizationCS-4513, D-Term Token system (continued) Advantages Fairness, no starvation Recovery from crashes if token is not lost Disadvantage Crash of process holding token Difficult to detect; difficult to regenerate exactly one token

SynchronizationCS-4513, D-Term Next Time Election algorithms for synchronization Consistency and Replication