CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Transactions are communications with ACID property: Atomicity: all or nothing Consistency:

Slides:



Advertisements
Similar presentations
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Distributed Mutual Exclusion.
Advertisements

CS542 Topics in Distributed Systems Diganta Goswami.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Leader Election Let G = (V,E) define the network topology. Each process i has a variable L(i) that defines the leader.  i,j  V  i,j are non-faulty.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
1 Algorithms and protocols for distributed systems We have defined process groups as having peer or hierarchical structure and have seen that a coordinator.
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.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
20101 Synchronization in distributed systems A collection of independent computers that appears to its users as a single coherent system.
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.
Distributed Mutual Exclusion Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4,
1 Distributed Process Management: Distributed Global States and Distributed Mutual Exclusion.
Distributed Systems Fall 2009 Distributed transactions.
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.
CIS 720 Distributed algorithms. “Paint on the forehead” problem Each of you can see other’s forehead but not your own. I announce “some of you have paint.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Mutual Exclusion.
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.
4.5 Distributed Mutual Exclusion Ranjitha Shivarudraiah.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
CSC Distributed Mutual Exclusion Presenter: Weiling Li Instructor: Dr. Zhang.
Diffusing Computation. Using Spanning Tree Construction for Solving Leader Election Root is the leader In the presence of faults, –There may be multiple.
MUTUAL EXCLUSION AND QUORUMS CS Distributed Mutual Exclusion Given a set of processes and a single resource, develop a protocol to ensure exclusive.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Chapter 2/6 –Critical Section Problem / Mutual exclusion progress, bounded wait –Hardware Solution disable interrupts –problems ? –Software Solution busy.
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.
1 Distributed Process Management Chapter Distributed Global States Operating system cannot know the current state of all process in the distributed.
Global State (1) a)A consistent cut b)An inconsistent cut.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
Vector Clock Each process maintains an array of clocks –vc.j.k denotes the knowledge that j has about the clock of k –vc.j.j, thus, denotes the clock of.
Studying Different Problems from Distributed Computing Several of these problems are motivated by trying to use solutiions used in `centralized computing’
Lecture 10 – Mutual Exclusion Distributed Systems.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion & Leader Election Steve Ko Computer Sciences and Engineering 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.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are: 1. Resource sharing 2. Avoiding concurrent update on shared data 3. Controlling the.
Page 1 Mutual Exclusion & Election Algorithms Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content.
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.
Lecture 7- 1 CS 425/ECE 428/CSE424 Distributed Systems (Fall 2009) Lecture 7 Distributed Mutual Exclusion Section 12.2 Klara Nahrstedt.
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
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.
Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: –Mutual exclusion.
CS 425 / ECE 428 Distributed Systems Fall 2015 Indranil Gupta (Indy) Oct 1, 2015 Lecture 12: Mutual Exclusion All slides © IG.
Introduction Many distributed systems require that participants agree on something On changes to important data On the status of a computation On what.
4.5 Distributed Mutual Exclusion
Mutual Exclusion Continued
Distributed Mutual Exclusion
Distributed Mutex EE324 Lecture 11.
Distributed Mutual Exclusion
Outline Distributed Mutual Exclusion Introduction Performance measures
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
CSE 486/586 Distributed Systems Leader Election
CSE 486/586 Distributed Systems Mutual Exclusion
Synchronization (2) – Mutual Exclusion
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
Distributed Mutual eXclusion
CSE 486/586 Distributed Systems Mutual Exclusion
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Transactions are communications with ACID property: Atomicity: all or nothing Consistency: interleaving results in serial execution in some order Isolation: Partial results are not visible outside Durability: After committing, the results are permanent

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Participant: 1.Prepare to commit the transaction by writing every update in activity log. 2.Write a precommit message in the activity log. Wait for request to vote from coordinator. 3.Wait for commit message from the coordinator. If received, commit the transaction. If abort message is received, abort the transaction.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Coordinator: 1.If the processor crashes, it will check the activity log for the transaction. 2.If the precommit message is not in the log, abort the transaction. 3.If the commit message is not in the log, retake the vote. 4.If the commit message is there in the log, finish the transaction.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Contention based Lamport’s algorithm, Ricart & Agrawala’s algorithm, Voting algorithm Token based Ring structure, tree structure, broadcast structure

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Every process maintains a queue of pending requests for entering critical section ordered according to the logical time- stamp. Requestor: 1.Send a request to every process. 2.After all replies are collected, enter its own request in its own queue 3.If own request is at the head of the queue, enter critical section. 4.Upon exiting the critical section, send a release message to every process.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Other processes: 1.After receiving a request, send a reply and enter the request in the queue 2.After receiving release message, remove the corresponding request from the queue. 3.If own request is at the head of the queue, enter critical section. Problems: 3(N-1) messages per requests Multiple points of failure

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Requestor: 1.Send a request to all other process. 2.Enter critical section upon receipt of reply from all processes. Other Processes: 1.Upon receipt of a request check whether it has any older (by logical clock) pending request of its own or whether it is executing in critical section. 2.If neither of the above conditions hold, send reply. Otherwise delay the reply message till both the conditions are false. Problems: 1.2(N-1) message exchange per request. 2.Multiple points of failure.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Requestor: 1.Send a request to all other process. 2.Enter critical section once REPLY from a majority is received 3.Broadcast RELEASE upon exit from the critical section. Other processes: 1.REPLY to a request if no REPLY has been sent. Otherwise, hold the request in a queue. 2.If a REPLY has been sent, do not send another REPLY till the RELEASE is received. Observations: 1.No single point of failure, but possibility of deadlock. 2.O(N) messages per request.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Requestor: 1.Send a request with time stamp to all other process. 2.Enter critical section once REPLY from a majority is received 3.Return the REPLY message upon receipt of an INQUIRY if not currently executing in the critical section. 4.Broadcast RELEASE upon exit from the critical section. Deadlock prevention method is used by ensuring no hold-and-wait

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Other processes: 1.If no REPLY has been sent, REPLY to any REQUEST. 2.If a REPLY has been sent but the RELEASE has not been received, compare the time stamp of the new REQUEST with the time stamp of the replied REQUEST. If the new REQUEST has an earlier time stamp, try to retract the old REPLY sending INQUIRY message. If the older REPLY is returned, send REPLY to the new REQUEST. Otherwise, wait for the RELEASE. Observation: 1.High (O(N)) messages per critical section entry.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Requestor: 1.Need to secure the REPLY messages from all members of its quorum only. To reduce message overhead, the set of (N) processes is divided into N sets S 1 to S n such that S i  S k is non-null for all i and k. S i is called the quorum of process i. Observations: 1.It is possible to reduce number of messages significantly. 2.Depending on the structure of the quorum and the exact algorithm, single point of failure may exist.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Control-token circulates in the system in some fixed order. Possession of the token grants permission to enter critical section. Ring structure – simple, deadlock-free, fair. The token circulates even in the absence of any request (unnecessary traffic). Long path (O(N)) – the wait for token may be high. Tree structure Broadcast structure

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan The processes are organized in a logical tree structure, each node pointing to its parent. Further, each node maintains a FIFO list of token requesting neighbors. Each node has a variable Tokenholder initialized to false for everybody except for the first token holder (token generator). Entry section: If not Tokenholder If the request queue empty request token from parent; put itself in request queue; block self until Tokenholder is true;

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Exit section: If the request queue is not empty parent = dequeue(request queue); send token to parent; set Tokenholder to false; if the request queue is still not empty, request token from parent;

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Upon receipt of a request: If Tokenholder If in critical section put the requestor in the queue else parent = requestor; Tokenholder = false; send token to parent; endif else if the queue is empty send a request to the parent; put the requestor in queue;

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Upon receipt of a token: Parent = Dequeue(request queue); if self is the parent Tokenholder = true else send token to the parent; if the queue is not emptyrequest token from parent; Note that all requests/token receipts must be processed in FIFO order and the routines must execute atomically.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Data Structure: The token contains Token vector T(.) – number of completion of the critical section for every process. Request queue Q(.) – queue of requesting processes. Every process (i) maintains the following seq_no – how many times i requested critical section. S i (.) – the highest sequence number from every process i heard of.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Entry Section (process i): Broadcast a REQUEST message stamped with seq_no. Enter critical section after receiving token. Exit Section (process i): Update the token vector T by setting T(i) to S i (i). If process k is not in request queue Q and there are pending requests from k (S i (k)>T(k)), append process k to Q. If Q is non-empty, remove the first entry from Q and send the token to the process indicated by the top entry.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Processing a REQUEST (process j): Set S j (k) to max(S j (k), seq_no) after receiving a REQUEST from process k. If holds an idle token, send it to k. Requires broadcast. Therefore message overhead is high.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Used to elect a centralized controller if the older one fails. The election of a new controller helps to alleviate some of the problems arising from having a single point of failure. Two types of election algorithm Extrema- finding – based on global priority Preference-based – based on local preferences.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Election algorithms and mutual-exclusion algorithms are similar in the sense that they try to find one process that will be leader or enter the critical section. However, there are significant differences between two. 1.Leader election is one time. A process may yield to another process. In mutual exclusion algorithm, a process competes until it succeeds. 2.In leader election starvation is not an issue. 3.Once the leader is elected, all other processes must know who is the leader.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Election algorithms are designed on the basis of the logical topology of the group of the processes. 1.Complete topology 2.Ring 3.Tree

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Assumptions: 1.A process may reach all other processes in one logical hop. 2.Communication is reliable, only processes may fail. 3.Time to handle a message is bounded. 4.Process faults are benign, i.e., a faulty process stops to generate messages. In other words, a process never generates confusing wrong messages. 5.Upon recovery, a process knows that it experienced a failure. 6.A failed process may rejoin the group upon recovery.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Our algorithm is an extrema-finding algorithm. It is called the bully algorithm. Upon detecting that the leader has failed, a process sends an inquiry message to all higher-priority processes. If no reply is received within the time-out period, the initiator sends an enter-election message to all lower priority processes. After the initiator receives a reply from all lower-priority processes or after the time-out, it declares itself as new leader and broadcasts that information to all processes. If a process receives an inquiry message from a lower priority process, it send inquiry message to all higher priority process and enters election.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Our algorithm is an extrema-finding algorithm. The processes are organized in a logical ring. The initiator sends a message along ring with its own id. Requesting everybody to elect it the leader. A process compares its own priority with that of the id. on an incoming message. If its own priority is higher, and it never forwarded any other messages, replace the message with its own id. and forward it. If its own priority is lower, forward the message. If the message carries its own id. then elect itself the leader and forward the election message. Message complexity O(N 2 ) in the worst-case, O(N) in the best-case.

CSC 8420 Advanced Operating Systems Georgia State University Yi Pan There are two types of election algorithms those use the logical tree topology. 1.The algorithm runs after the spanning tree is constructed. 2.The algorithm runs before the spanning tree is constructed and constructs the spanning tree in the process.