Ordering and Consistent CutsIntroductionA distributed system is ….Distributed ComputationSo what does this global history as defined tell us?Happened Before Relation (→)Space Time DiagramIs this notion of ordering really important?Global States and CutsExample of a CutIntroduction to consistencySlide 12So what went wrong?So what is a consistent global state?Passive Deadlock DetectionFIFO ChannelsOk let’s now fix consistencyClock ConditionLogical ClocksLamport’s ClocksExample of Logical ClocksObservations on Lamports ClocksVector Clocks ExampleLet’s formalise the ideaSo are Lamport clocks useful only for finding global state?AlgorithmAlgorithm SummaryGlobal State RevisitedRequirementsGlobal StatesWhat exactly is channel stateBasic Algorithm DescriptionSlide 33Comments on AlgorithmConclusionOrdering and Consistent CutsPresented ByBiswanath PandaIntroductionOrdering and global state detection in a “distributed system”Fundamental QuestionsWhat is a distributed system?What is a distributed computation?How can we represent a distributed system?Why are today’s papers so important?A distributed system is ….A collection of sequential processes p1, p2, p3…..pnNetwork capable of implementing communication channels between pairs of processes for message exchangeChannels are reliable but may deliver messages out of orderEvery process can communicate with every other process(may not be directly)There is no reasoning based on global clocksAll kinds of synchronization must be done by message passingDistributed ComputationA distributed computation is a single execution of a distributed program by a collection of processes. Each sequential process generates a sequence of events that are either internal events, or communication eventsThe local history of process pi during a computation is a (possibly infinite) sequence of events hi = ei1, ei2…....A partial local history of a process is a prefix of the local history hin = ei1 , ei2 … einThe global history of a computation is the set H = Ui=1n hiSo what does this global history as defined tell us?It is just the collection of events that have occurred in the systemIt does not give us any idea about the relative times between the eventsAs there is no notion of global time, events can only be ordered based on a notion of cause and effectSo lets formalize this ideaHappened Before Relation (→)If a and b are events in the same process then a → bIf a is the sending of a message m by a process and b is the corresponding receive event then a → bFinally if a → b b → c then a → cIf a → b and b → a then a and b are concurrent→ defines a partial order on the set HSpace Time DiagramGraphical representation of a distributed systemIf there is a path between two events then they are relatedElse they are concurrentIs this notion of ordering really important?Some idea of ordering of events is fundamental to reason about how a system worksGlobal State Detection is a fundamental problem in distributed computingEnables detecting stable properties of a systemHow do we get a snapshot of the system when there is no notion of global time or shared memoryHow do we ensure that that the state collected is consistentUse this problem to illustrate the importance of ordering This will also give us the notion of what is a consistent global stateGlobal States and CutsGlobal State is a n-tuple of local states one for each processCut is a subset of the global history that contains an initial prefix of each local stateTherefore every cut is a natural global stateIntuitively a cut partitions the space time diagram along the time axisA Cut is identified by the last event of each process that is part of the cutExample of a CutIntroduction to consistencyConsider this solution for the common problem of deadlock detectionSystem has 3 processes p1, p2, p3An external process p0 sends a message to each process (Active Monitoring)Each process on getting this message reports its local stateNote that this global state thus collected at p0 is a cutp0 uses this information to create a wait for graphConsider the space time diagram below and the cut C21 2 3 Cycle formedSo what went wrong?p0 detected a cycle when there was no deadlockState recorded contained a message received by p3 which p1 never sentThe system could never be in such a state and hence the state p0 saw was inconsistentSo we need to make sure that application see consistent statesSo what is a consistent global state?A cut C is consistent if for all events e and e’Intuitively if an event is part of a cut then all events that happened before it must also be part of the cutA consistent cut defines a consistent global stateNotion of ordering is needed after all !! CeeeCe ''Passive Deadlock DetectionLet’s change our approach to deadlock detection p0 now monitors the system passivelyEach process sends p0 a message when an event occursWhat global state does p0 now seeBasically hell breaks loseFIFO ChannelsCommunication channels need not preserve message orderTherefore p0 can construct any permutation of events as a global stateSome of these may not even be valid (events of the same process may not be in order)Implement FIFO channels using sequence numbersNow we know that we p0 sees constructs valid runsBut the issue of consistency still remains)'()()'()( mdelivermdel ivermsendmsendjjiiOk let’s now fix consistencyAssume a global real-time clock and bound of δ on the message delayDon’t panic we shall get rid of this assumption soonRC(e): Time when event e occursEach process reports to p0 the global timestamp along with the eventDelivery Rule at p0: At time t, deliver all received messages upto t- δ in increasing timestamp orderSo do we have a consistent state now?Clock ConditionYes we do!!e is observed before e’ iff RC(e) < RC(e’)Recall our definition of consistencyTherefore state is consistent iffThis is the clock conditionFor timestamps from a global clock this is obviously trueCan we satisfy it for asynchronous systems? CeeeCe '')'()(' eRCeRCee Logical ClocksTurns out that the clock condition can be satisfied in asynchronous systems as well→ is defined such that Clock
View Full Document