Presentation is loading. Please wait.

Presentation is loading. Please wait.

Outline Theoretical Foundations - continued Lab 1

Similar presentations


Presentation on theme: "Outline Theoretical Foundations - continued Lab 1"— Presentation transcript:

1 Outline Theoretical Foundations - continued Lab 1
Lamport’s algorithm for distributed mutual exclusion Casual ordering of messages – continued Global state Cuts Termination detection 1/3/2019 COP5611

2 Regarding Lab 1 For this project, you can work as a team with at most two members per team Each team only needs to turn in one report However, all the members are required to understand all the parts as you may be tested on the midterm or the final exam Three processes Bank Account Server Bank Office Clients Bank Office Mutual Exclusion Processes 1/3/2019 COP5611

3 Lamport’s Clock Implementation rules
[IR1] Clock Ci is incremented between any two successive events in process Pi Ci := Ci + d ( d > 0) [IR2] If event a is the sending of message m by process Pi, then message m is assigned a timestamp tm = Ci(a). On receiving the same message m by process Pj, Cj is set to Cj := max(Cj, tm + d) 1/3/2019 COP5611

4 Total Ordering Using Lamport’s Clocks
If a is any event at process Pi and b is any event at process Pj, then a => b if and only if either Where is any arbitrary relation that totally orders the processes to break ties 1/3/2019 COP5611

5 Lamport’s Distributed Mutual Exclusion Algorithm
This algorithm is based on the total ordering using Lamport’s clocks Each process keeps a Lamport’s logical clock Each process is associated with a unique id that can be used to break the ties In the algorithm, each process keeps a queue, request_queuei, which contains mutual exclusion requests ordered by their timestamp and associated id Ri of each process consists of all the processes The communication channel is assumed to be FIFO 1/3/2019 COP5611

6 Lamport’s Distributed Mutual Exclusion Algorithm – cont.
1/3/2019 COP5611

7 Lamport’s Distributed Mutual Exclusion Algorithm – cont.
1/3/2019 COP5611

8 Vector Clocks Implementation rules
[IR1] Clock Ci is incremented between any two successive events in process Pi Ci[i] := Ci[i] + d ( d > 0) [IR2] If event a is the sending of message m by process Pi, then message m is assigned a timestamp tm = Ci(a). On receiving the same message m by process Pj, Cj is set to Cj[k] := max(Cj[k], tm[k]) 1/3/2019 COP5611

9 Vector Clocks – cont. In a system of vector clocks, where 1/3/2019
COP5611

10 Causal Ordering of Messages
The causal ordering of messages tries to maintain the same causal relationship that holds among “message send” events with the corresponding “message receive” events In other words, if Send(M1) -> Send(M2), then Receive(M1) -> Receive(M2) This is different from causal ordering of events 1/3/2019 COP5611

11 Birman-Schiper-Stephenson Protocol
1/3/2019 COP5611

12 Schiper-Eggli-Sando Protocol
1/3/2019 COP5611

13 Schiper-Eggli-Sando Protocol – cont.
1/3/2019 COP5611

14 Schiper-Eggli-Sando Protocol – cont.
1/3/2019 COP5611

15 Global State 1/3/2019 COP5611

16 Local State Local state More notations
For a site Si, its local state at a given time is defined by the local context of the distributed application, denoted by LSi. More notations mij denotes a message sent by Si to Sj send(mij) and rec(mij) denote the corresponding sending and receiving event. 1/3/2019 COP5611

17 Definitions – cont. 1/3/2019 COP5611

18 Definitions – cont. 1/3/2019 COP5611

19 Global State – cont. 1/3/2019 COP5611

20 Definitions – cont. Strongly consistent global state:
A global state is strongly consistent if it is consistent and transitless 1/3/2019 COP5611

21 Global State – cont. 1/3/2019 COP5611

22 Chandy-Lamport’s Global State Recording Algorithm
1/3/2019 COP5611

23 Cuts of a Distributed Computation
A cut is a graphical representation of a global state A consistent cut is a graphical representation of a consistent global state Definition A cut of a distributed computation is a set C={c1, c2, ...., cn}, where ci is a cut event at site Si in the history of the distributed computation 1/3/2019 COP5611

24 Cuts of a Distributed Computation – cont.
1/3/2019 COP5611

25 Cuts of a Distributed Computation – cont.
1/3/2019 COP5611

26 Cuts of a Distributed Computation – cont.
1/3/2019 COP5611

27 Cuts of a Distributed Computation – cont.
1/3/2019 COP5611

28 Cuts of a Distributed Computation – cont.
1/3/2019 COP5611

29 Termination Detection
Termination detection is to detect when a distributed algorithm is terminated, such as election, a deadlock detection, or token generating algorithm A process can be active or idle A computation is said to have terminated if and only if all the processes are idle and there are no messages in transit Basic idea We are not going to cover the algorithm in detail 1/3/2019 COP5611

30 Summary The absence of global time and the absence of shared memory are two main characteristics of distributed systems Two schemes, Lamport’s logical clocks and vector clocks are used to order events Two algorithms for causal ordering of messages based on the vector clock-based ideas are discussed Global states and cuts of a distributed system are also covered These provide the theoretical foundations for other distributed algorithms 1/3/2019 COP5611


Download ppt "Outline Theoretical Foundations - continued Lab 1"

Similar presentations


Ads by Google