1 Algorithms and protocols for distributed systems We have defined process groups as having peer or hierarchical structure and have seen that a coordinator.

Slides:



Advertisements
Similar presentations
CS542 Topics in Distributed Systems Diganta Goswami.
Advertisements

CS 542: Topics in Distributed Systems Diganta Goswami.
CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Distributed Systems Distributed Coordination. Introduction Concurrent processes in same system –Common memory and clock –Easy to see order of events Concurrent.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at University.
Synchronization in Distributed Systems
CS 582 / CMPE 481 Distributed Systems
What we will cover…  Distributed Coordination 1-1.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
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.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
Chapter 18: Distributed Coordination (Chapter 18.1 – 18.5)
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Election Algorithms and Distributed Processing Section 6.5.
Election Algorithms. Topics r Issues r Detecting Failures r Bully algorithm r Ring algorithm.
Distributed Mutex EE324 Lecture 11.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 6 Synchronization.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
4.5 DISTRIBUTED MUTUAL EXCLUSION MOSES RENTAPALLI.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
1 Mutual Exclusion: A Centralized Algorithm a)Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b)Process.
Operating Systems Distributed Coordination. Topics –Event Ordering –Mutual Exclusion –Atomicity –Concurrency Control Topics –Event Ordering –Mutual Exclusion.
CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
Coordination and Agreement. Topics Distributed Mutual Exclusion Leader Election.
CS 425/ECE 428/CSE424 Distributed Systems (Fall 2009) Lecture 8 Leader Election Section 12.3 Klara Nahrstedt.
Global State (1) a)A consistent cut b)An inconsistent cut.
Synchronization CSCI 4780/6780. Mutual Exclusion Concurrency and collaboration are fundamental to distributed systems Simultaneous access to resources.
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 15/01/2008.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
Lecture 11-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) September 28, 2010 Lecture 11 Leader Election.
Lecture 10 – Mutual Exclusion Distributed Systems.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
1.Mutual Exclusion in Distributed Systems 2.Non-Token-Based Algorithms 3.Token-Based Algorithms 4.Distributed Election 5.The Bully and the Ring-Based Algorithms.
Election Distributed Systems. Algorithms to Find Global States Why? To check a particular property exist or not in distributed system –(Distributed) garbage.
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.
Synchronization. Clock Synchronization In a centralized system time is unambiguous. In a distributed system agreement on time is not obvious. When each.
Lecture 12-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) October 4, 2012 Lecture 12 Mutual Exclusion.
Synchronization in Distributed Systems Chapter 6.3.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
CSE 486/586 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Transactions are communications with ACID property: Atomicity: all or nothing Consistency:
Distributed Systems Lecture 9 Leader election 1. Previous lecture Middleware RPC and RMI – Marshalling 2.
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:
CS 425 / ECE 428 Distributed Systems Fall 2015 Indranil Gupta (Indy) Oct 1, 2015 Lecture 12: Mutual Exclusion All slides © IG.
Distributed Systems 31. Theoretical Foundations of Distributed Systems - Coordination Simon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano.
Mutual Exclusion Continued
Lecture 17: Leader Election
Distributed Mutex EE324 Lecture 11.
Chapter 6.3 Mutual Exclusion
Distributed Mutual Exclusion
Outline Distributed Mutual Exclusion Introduction Performance measures
CSE 486/586 Distributed Systems Leader Election
CSE 486/586 Distributed Systems Mutual Exclusion
Lecture 10: Coordination and Agreement
Synchronization (2) – Mutual Exclusion
Prof. Leonardo Mostarda University of Camerino
Lecture 11: Coordination and Agreement
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
CSE 486/586 Distributed Systems Mutual Exclusion
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

1 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 peer structure, an external process may send an update request to any group member, which then functions as coordinator. We have seen that deadlock may occur. If the group has hierarchical structure, one member is elected as coordinator. That member must manage group protocols, and external requests must be sent on to it. Note that this solves the potential deadlock problem of concurrent updates. But a single point of failure is created, and a potential bottleneck, so this is only suitable for small groups. If the coordinator fails, a new one must be elected. For the election algorithm: assume that: - each process has a unique ID known to all members - the process with highest ID is coordinator Distributed algorithms

2 Election algorithm - Bully P notices no reply from coordinator P sends ELECT message to all processes with higher IDs If any reply, P exits. Any process that replies must itself run an election. If none reply, P wins – gets any required state from persistent storage – P sends COORD message to the group Distributed algorithms (i) (ii) ELECT (3 and 4 run election) ELECT (2 runs election) ACK (2 exits) ACK (3 exits) no ACK, so 4 sends COORD to all

3 Election algorithm - Ring Processes are ordered into a ring structure that is known to all. A failed process can be bypassed, provided that the ordering around the ring is known and that messages are acknowledged, so that a no-ACK can be detected. The election algorithm: P notices that the coordinator is not functioning. P sends an ELECT message to the next process in the ring, tagged with its own (P’s) ID On receipt of ELECT by any process: - without receiver’s (its own) ID: append receiver’s ID to message and send to next process in ring - with receiver’s ID (it’s been all round): look for highest ID in list of appended IDs and send COORD (highest ID) message Many election algorithms can run concurrently All should agree on the same highest ID Distributed algorithms

4 Distributed mutual exclusion Suppose N processes hold an object replica and it is required that only one-at-a-time may access its replica. Examples: - ensuring coherence of distributed shared memory - distributed games - distributed whiteboard i.e. for use by simultaneously running, tightly coupled components managing object replicas in main memory. We have already seen the approach of LOCKING persistent object replicas for consistent, transactional update. Assume that - processes update in place - then the update is propagated (not shown as part of the algorithm) Each process executes code of the form: entry protocol access object under exclusion, in a critical region exit protocol Distributed algorithms

5 Distributed mutex 1. centralised algorithm One process is the elected coordinator entry protocol send request message to coordinator wait for reply (OK-to- enter) from coordinator access object under exclusion exit protocol send finished message to coordinator + fair FCFS or priority if coordinator re-orders + economical (3 messages in basic protocol, but need more....) – coordinator is single point of failure (need to elect a new one if it fails) – what does no reply mean? waiting for exclusive access – OK but coordinator could have failed Improve/solve by using extra messages: - coordinator ACKs request and sends again when process can proceed? - heartbeat protocol between coordinator and processes awaiting object access Distributed algorithms

6 Distributed mutex 2 – Token Ring A token giving permission to access the object circulates indefinitely entry protocol wait for token to arrive access object under exclusion exit protocol pass on token – Not controllable – ring order, not request order or priority order – Quite efficient, but token circulates when no process wants object access – Must handle loss of token and regeneration, ensuring one token only – crashes? Use ACKs, reconfigure, bypass failed processes Distributed algorithms

7 3. Distributed peer-to-peer algorithm entry protocol send a timestamped request to all processes including oneself (there is a convention for ordering timestamps: earliest timestamp wins + tiebreaker) only when ALL processes have sent reply can the object be accessed Any process executing the protocol, so wanting access, sends a reply to all processes whose request messages have earlier timestamps than its own message access object under exclusion exit protocol reply to any deferred requests + fair FCFS – not economical, 2N messages + any ACKs – N points of failure – N bottlenecks – no reply? Failure or deferring? A bad idea – requiring ALL processes to act before any one can proceed. Distributed algorithms