Chapter 17 Theoretical Issues in Distributed Systems

Slides:



Advertisements
Similar presentations
Global States.
Advertisements

Logical Clocks (2).
Virtual Time “Virtual Time and Global States of Distributed Systems” Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.
SES Algorithm SES: Schiper-Eggli-Sandoz Algorithm. No need for broadcast messages. Each process maintains a vector V_P of size N - 1, N the number of processes.
Uncoordinated Checkpointing The Global State Recording Algorithm.
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Distributed Computing 5. Snapshot Shmuel Zaks ©
1 Causality. 2 The “happens before” relation happens before (causes)
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
CS 582 / CMPE 481 Distributed Systems
Ordering and Consistent Cuts Presented By Biswanath Panda.
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
Distributed Systems Fall 2009 Logical time, global states, and debugging.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Ordering and Consistent Cuts Presented by Chi H. Ho.
Time, Clocks and the Ordering of Events in a Distributed System - by Leslie Lamport.
Cloud Computing Concepts
1 Distributed Process Management: Distributed Global States and Distributed Mutual Exclusion.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Clock Synchronization Physical clocks Clock synchronization algorithms –Cristian’s.
Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms CS 249 Project Fall 2005 Wing Wong.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
Distributed Systems Foundations Lecture 1. Main Characteristics of Distributed Systems Independent processors, sites, processes Message passing No shared.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Logical Clocks and Global State.
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
Logical Clocks (2). Topics r Logical clocks r Totally-Ordered Multicasting r Vector timestamps.
Chapter 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.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Project Reference Some slides are in courtesy of Dr. Erciyes,
Distributed Computing 5. Snapshot Shmuel Zaks ©
1 Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms Author: Ozalp Babaoglu and Keith Marzullo Distributed Systems: 526.
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
1 Distributed Process Management Chapter Distributed Global States Operating system cannot know the current state of all process in the distributed.
Lamport’s Logical Clocks & Totally Ordered Multicasting.
“Virtual Time and Global States of Distributed Systems”
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Distributed Systems Fall 2010 Logical time, global states, and debugging.
CIS825 Lecture 2. Model Processors Communication medium.
9/14/20051 Time, Clocks, and the Ordering of Events in a Distributed System by L. Lamport CS 5204 Operating Systems Vladimir Glina Fall 2005.
D u k e S y s t e m s Asynchronous Replicated State Machines (Causal Multicast and All That) Jeff Chase Duke University.
D ISTRIBUTED S YSTEM UNIT-2 Theoretical Foundation for Distributed Systems Prepared By: G.S.Mishra.
Logical Clocks. Topics r Logical clocks r Totally-Ordered Multicasting.
Event Ordering. CS 5204 – Operating Systems2 Time and Ordering The two critical differences between centralized and distributed systems are: absence of.
Lecture 1: Logical and Physical Time with some Applications Anish Arora CSE 6333 Notes include material from Dr. Jeff Brumfield.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CS533 Concepts of Operating Systems Class 8 Time, Clocks, and the Ordering of Events in a Distributed System By Constantia Tryman.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
Distributed Systems Lecture 6 Global states and snapshots 1.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Global state and snapshot
Global state and snapshot
CSE 486/586 Distributed Systems Global States
Overview of Ordering and Logical Time
COT 5611 Operating Systems Design Principles Spring 2012
Logical Clocks and Casual Ordering
Outline Theoretical Foundations - continued Lab 1
Time And Global Clocks CMPT 431.
Chapter 5 (through section 5.4)
Basics of Distributed Systems
Slides for Chapter 11: Time and Global State
Lecture 8 Processes and events Local and global states Time
Outline Theoretical Foundations - continued
CSE 486/586 Distributed Systems Global States
Jenhui Chen Office number:
COT 5611 Operating Systems Design Principles Spring 2014
Outline Theoretical Foundations
Presentation transcript:

Chapter 17 Theoretical Issues in Distributed Systems Copyright © 2008

Introduction Notions of Time and State States and Events in a Distributed System Time, Clocks and Event Precedences Recording the State of a Distributed System Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 2

Notions of Time and State Time indicates when an event occurred State of an entity is the condition/mode of its being Depends on its features Global state of a system comprises the states of all entities in the system at a specific instant of time OS uses the notions of time and state for performing scheduling of resources and the CPU: Find chronological order in which requests occurred Distributed OS uses them for recovery Problem: lack of global clock in distributed systems Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 3

States and Events in a Distributed System Local and Global States Events Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 4

Local and Global States Each entity in a system has its own state State of a memory cell is the value contained in it State of CPU is contents of PSW and GPRs State of process: State of memory allocated to it, CPU state (if running), state of interprocess communication The state of an entity is a local state State of process Pk at time t: Skt Global state: collection of local states of all entities at the same instant of time Global state of system at time t: St={S1t, S2t,…, Snt} Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 5

Events An event can be: sending/receiving a message (over a channel), or other (no messages involved) Channel: an interprocess communication path Process state changes when an event occurs in it We represent an event as follows: (process id, old state, new state, event description, channel, message) Channel and message are “–” if event does not involve sending or receiving of a message Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 6

Time, Clocks, and Event Precedences Global clock: abstract clock that can be accessed from different sites of a distributed system with identical results Cannot be implemented in practice due to unbounded communication delays Alternative: use local clocks in processes Local clocks should be reasonably well synchronized Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 7

Event Precedence e1 → e2 indicates event e1 precedes e2 in time i.e., e1 occurred before e2 Event ordering implies arranging a set of events in a sequence such that each event in the sequence precedes the next one A total order (with respect to “→”) exists if all events that can occur in a system can be ordered A partial order implies that some events can be ordered but not all events can be ordered A casual relationship is used to deduce precedences A “message send” event precedes “message receive” Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 8

Event Precedence (continued) ei precedes ej : If ek and el exist such that ek →el , ei → ek or ei ≡ ek, and el →ej or el ≡ ej ei follows ej : If eg and eh exist such that eg → eh, ej →eg or ej ≡ eg, and eh →ei or eh ≡ ei ei is concurrent with ej : If ei neither precedes nor follows ej Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 9

Example: Event Precedence Timing diagram: plot of the activities of different processes against time Events in Pi are denoted as ei1, ei2, .. e23 is a message send event for message m1 e12 is a message receive event Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 10

Logical Clocks Timestamping (according to local clock) of events provides a direct method of event ordering Clocks are loosely synchronized using causality Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 11

Logical Clocks (continued) A logical clock (LCk) is incremented by 1 only when an event occurs in process Pk ts(ei) < ts(ej) if ei → ej Problem: ts(ei) < ts(ej) does not imply ei → ej Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 12

Obtaining Unique Timestamps Logical clock timestamps are not unique, so cannot be used to obtain a total order over events Problem can be overcome by using a pair pts(ei) as the timestamp of ei, where pts(ei) ≡ (local time, process id) Event ordering rules: ei precedes ej iff (i) pts(ei).local time < pts(ej).local time, or (ii) pts(ei).local time = pts(ej).local time and pts(ei).process id < pts(ej).process id Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 13

Vector Clocks A vector clock contains n elements, where n is the number of processes in the distributed system Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 14

Vector Clocks (continued) Precedence rules: ei precedes ej: For all l: vts(ei )[l] ≤ vts(ej )[l], but for some k: vts(ei )[k]  vts(ej )[k] ei follows ej: For all l: vts(ei )[l] ≥ vts(ej )[l], but ei , ej are concurrent: For some k, l: vts(ei )[k] < vts(ej )[k], and vts(ei )[l] > vts(ej )[l] vts(ei ) < vts(ej )[l] if and only if ei → ej Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 15

Example: Synchronization of Vector Clocks Total order can be obtained using a pair pvts(ei) ≡ (local time, process id) as timestamp of ei Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 16

Recording the State of a Distributed System Problem: it is not possible to get all nodes to record their states at the same time instant Local clocks are not perfectly synchronized Any other collection of local states may be inconsistent Alternative: algorithm for obtaining a consistent collection of local states Collected state not a substitute for the global state However, has properties that facilitate some of the control functions in a distributed OS Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 17

Recording the State of a Distributed System (continued) Example: inconsistent state recording Banking application: P1 in N1 and P2 in N2 Actions: P1 debits $100 to account A in node N1 P1 sends message to P2 to credit $100 to account B P2 credits $100 to account B in node N2 Inconsistent if A’s balance is recorded before (1) and B’s balance is recorded after (3) Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 18

Consistent State Recording State recording: collection of local states of entities in a system obtained through some algorithm Consistent state recording: one in which process states of every pair of processes in the system are consistent according to: Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 19

Properties of a Consistent State Recording A cut Process states are recorded at tP1.. tP4 Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Operating Systems, by Dhananjay Dhamdhere 20

Properties of a Consistent State Recording (continued) “A cut is taken” means that a collection of local states is recorded A cut represents a consistent state recording of a system if the states of each pair of processes satisfy Definition 17.1 State of a channel is the set of messages it contains A cut may intersect with a message: Forward or backward intersection Backward intersection makes a cut inconsistent Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 21

Properties of a Consistent State Recording (continued) Consistency condition for a cut: CC: Cut C represents a consistent state recording of a distributed system if future of cut is closed under the precedes relation on events (closed under “→”) Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 22

Chandy–Lamport Algorithm for state recording Assumptions of the algorithm Channels are FIFO Channels are unidirectional Channels have unbounded message buffering capacities The state of a process indicates the messages sent and received by it A special message called a marker is sent to ask a process to record its state Process receives markers over all channels incident on it Records state of channel over which it received a marker If it is the first marker received, it also records its own state Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 Operating Systems, by Dhananjay Dhamdhere 23

An Algorithm for Consistent State Recording Notation: Receivedij : Messages received by Pj over channel Chij Recorded_recdij : Messages recorded as received in the state of Pj Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 24

Example: Operation of the Chandy−Lamport Algorithm Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 25

Example: Recorded State versus Global State Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 26

Summary Operating systems use notions of time and state Local state: State of an entity Global state: States of all entities at the same time instant Precedence of events may be deduced using the causal relationship, i.e., cause-and-effect relationship, and transitivity property of precedence Some events may be concurrent It is laborious to deduce the precedence of events by using transitivity, hence timestamps are used instead Use local clocks in processes Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 27

Summary Using local clocks in processes Logical clocks Vector clocks Include process ids in timestamps for total ordering It is not possible to record the global state of a system Chandy-Lamport algorithm obtains consistent recording of process states using special messages called markers Operating Systems, by Dhananjay Dhamdhere Operating Systems, by Dhananjay Dhamdhere Copyright © 2008 28