Download presentation
Presentation is loading. Please wait.
Published byAmie Powers Modified over 9 years ago
1
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti
2
Introduction Logical time is a notion used for simplifying the job of programming an asynchronous network Logical time is an element of some fixed totally ordered set T={t1,t2…..}, which is to be assigned for every execution of an asynchronous network A Logical time of all events should respect all the dependencies among the events within a system A.
3
Logical Time for Send/Receive Systems If a is an execution of an asynchronous send/receive network, then logical time for a is assigning a value of T={t1.t2…} to every event in a. Assumptions –Only universal reliable FIFO send/receive channels are considered. –No internal events are considered
4
Properties for assigning Logical time to S/R 1)No two events get assigned the same logical time. 2)The logical times of events at each process are strictly increasing, according to their order of occurrence in a. 3)The logical time of any send event is strictly smaller than that of the corresponding receive event. 4)For any t belongs to T, there are only finite many events that get assigned logical times smaller than t.
5
Logical time for Broadcast Systems To define logical time for broadcast systems all the events are considered. For any execution a,logical time assignment is assigning a value T to very event in a, in such a way as to satisfy same properties as for S/R systems except property 3 i.e; –The logical time of any bcast event is strictly smaller than that of each corresponding receive event.
6
Adding Logical Time to Asynchronous Algorithms Logical times are generated for the events of a given asynchronous S/R network algorithm A. The given algorithm A transforms into a new asynchronous S/R algorithm L(A). The transformation works process by process. Whenever a process of L(A) simulates a step of A, it also generates a logical time.
7
Advancing the clock (1.Lamport-Time Transformation) In this algorithm local clocks are maintained and advanced when messages are received in order to keep them synchronized. Logical time domain T is a set of pairs (c,i) where c is a non-negative integer, i is a process index. The clock variable gets increased by at least 1 at every event that occurs at process i. The logical time of any event is defined to be the value of the clock variable immediately after the event, paired with process index i as a tie breaker
8
Lamports time transformation contd... Send-The clock value of send event is attached as time stamp to the mesg being sent. Receive-For every receive event, i increases its clock variable larger than its previous value and than the timestamp of the mesg. LamportTime(A) satisfies all the properties of definition of logical time. LamportTime transformation can be easily modified to work in asynchronous broadcast systems.
9
Delaying Future Events (2.WelchTime Transformation) Clocks are not advanced in response to mesg receipts, but mesg’s that arrive early are delayed. Domain T is a set of triples (c,i,k), where c is a nonnegative real, i process index, k belongs to N +. Logical time of any event is defined to be the value of the clock when the event occurs. Process i maintains a FIFO receive-buffer in order to hold mesg’s whose timestamps are greater than or equal to the local clock value.
10
WelchTime contd.. For every mesg if timestamp is less than current clock value, mesg is processed, else it is placed in receive-buffer, they are processed in the order in which they appear in the receive-buffer. The unbounded ness of the local clock variables also implies that every mesg in a receive-buffer is eventually processed. WelchTime(A) satisfies all the properties of definition of logical time. WelchTime transformation can be modified to work in asynchronous broadcast systems.
11
Applications Banking Systems For counting the total amount of money that is transferred between process via mesg. Each process has a local variable that money that contains current amount at that location. CountMoney algorithm transformed from algorithm A finds the local balance
12
CountMoney Algorithm It has a subroutine with predetermined logical time t belongs to T, assuming t is known, general strategy is 1)For each process of A, determine the value of the money variable after all events with logical times less than or equal to t and before all events with logical times greater than t. 2)For each channel, determine the amount of money in all the messages sent at logical times less than or equal to t but received at logical times strictly greater than t.
13
$10$30$20 $4 $5 $3 $2 $1 1 2 3 2 10 7 6 3 4 1 8 5 9
14
Global Snapshots CountMoney generalised to get an instantaneous global snapshot of system state. useful for debugging,in case of failure,or detecting certain global properties. it is possible to get a global snapshot by delaying process and mesg’s till it records all the needed information, but not practical. true global snapshot may not be needed, but a system state that “look-like” global snapshot to all processes is good enough.
15
LogicalTimeSnapShot algorithm As in CountMoney,it has a subroutine with predetermined logical time t belongs to T, assuming t is known, general strategy is 1)determine the state of each process of A after all events with logical times less than or equal to t and before all events with logical times greater then t. 2)For each channel, determine the sequence of messages sent at logical times less than or equal to t but received at logical times strictly greater then t. --this information is determined by same distributed algo. (CountMoney)
16
ReplicatedStateMachine Algorithm To simulate single state machine or single shared variable, say x. Consider there are n user processes submitting invocations to x and receiving responses from x. One user process U i at each node i of the network. The network as a whole should be atomic object. ALGO:- Each process A i simply receives invocations from user U i and broadcasts them. Each process has a local copy of x and a local variable invocation- buffer in which it stores all invocations. Process i places local invocation in its invocation-buffer when it performs the broadcast and places remote invocation when it performs the receive for that invocation.
17
Continued… Process i maintains a vector known-time, which keeps track of largest local time for each process. –Known-time(i)i = logical time of most recent event at process i. –Known-time(j)i = logical time of broadcast event received by i from j. Process i is permitted to apply an invocation pi in its invocation-buffer to its copy of x when following is true. –Invocation pi has the smallest logical time of any invocation in invocation-buffer (i). –For every j, known-time(j)i >= logical time of pi.
18
Transforming Real-Time Algorithms to Logical-Time Algorithms S/R system A,in which each process Ai has a real-time value Times occurring as arguments in its output event should be nondecreasing and unbounded in any fair execution. It is possible to transform each process Ai into a process Bi without real-time,but with logical time.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.