CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou.

Slides:



Advertisements
Similar presentations
Last Class: Clock Synchronization
Advertisements

Virtual Time “Virtual Time and Global States of Distributed Systems” Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.
Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2011 August 30, 2011 Lecture 3 Time and Synchronization Reading: Sections
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Logical Clocks and Global State.
Distributed Systems Spring 2009
CMPT 431 Dr. Alexandra Fedorova Lecture VIII: Time And Global Clocks.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Logical Time and Logical Clocks
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
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.
Lecture 2-1 CS 425/ECE 428 Distributed Systems Lecture 2 Time & Synchronization Reading: Klara Nahrstedt.
Lecture 3-1 Computer Science 425 Distributed Systems Lecture 3 Logical Clock and Global States/ Snapshots Reading: Chapter 11.4&11.5 Klara Nahrstedt.
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.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Project Reference Some slides are in courtesy of Dr. Erciyes,
Logical Clocks n event ordering, happened-before relation (review) n logical clocks conditions n scalar clocks condition implementation limitation n vector.
1 Causal Delivery Advanced Networks PhD. Saúl Pomares Hernández.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
Synchronization. Why we need synchronization? It is important that multiple processes do not access shared resources simultaneously. Synchronization in.
“Virtual Time and Global States of Distributed Systems”
CSE 486/586 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Communication & Synchronization Why do processes communicate in DS? –To exchange messages –To synchronize processes Why do processes synchronize in DS?
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
Lecture 9: Time and clocks (Chap 11) Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
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.
Lecture 5-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) September 10, 2013 Lecture 5 Time and Synchronization.
Feb 15, 2001CSCI {4,6}900: Ubiquitous Computing1 Announcements.
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.
Logical Clocks event ordering, happened-before relation (review) logical clocks conditions scalar clocks  condition  implementation  limitation vector.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Logical Time Steve Ko Computer Sciences and Engineering University at Buffalo.
Indranil Gupta (Indy) Topic: Time and Ordering Lecture A: Introduction and Basics Cloud Computing concepts All slides © IG.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Logical time Causality between events is fundamental to the design of parallel and distributed systems. In distributed systems, it is not possible to have.
Greetings. Those of you who don't yet know me... Today is... and
Time and Synchronization
Time and Clock Primary standard = rotation of earth
CSE 486/586 Distributed Systems Logical Time
CSC 8320 Advanced Operating System
Time and Synchronization
CSE 486/586 Distributed Systems Logical Time
Overview of Ordering and Logical Time
SYNCHORNIZATION Logical Clocks.
Time and Clock.
湖南大学-信息科学与工程学院-计算机与科学系
COT 5611 Operating Systems Design Principles Spring 2012
Distributed Systems CS
Lecture 12: Time and Ordering
Time and Clock.
Logical Clocks and Casual Ordering
Outline Theoretical Foundations - continued Lab 1
Time And Global Clocks CMPT 431.
Event Ordering.
Concurrent events If a, b are concurrent, LT(a) and LT(b) may have arbitrary values! Thus, logical time lets us determine that a potentially happened before.
Outline Theoretical Foundations
Distributed Systems CS
Chapter 5 (through section 5.4)
Basics of Distributed Systems
Lecture 8 Processes and events Local and global states Time
Outline Theoretical Foundations - continued
Distributed Systems CS
Distributed algorithms
CSE 486/586 Distributed Systems Logical Time
CSE 542: Operating Systems
COT 5611 Operating Systems Design Principles Spring 2014
Outline Theoretical Foundations
Presentation transcript:

CS 425 / ECE 428  2013, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi, J. Hou

Basics A Distributed System (DS) consists of a number of processes. Each process has a state (values of variables). State of a may change as a result of a computation step or communication step Processes may communicate by message-passing or via shared memory Message-passing: Send & Receive message Shared memory: Write & Read shared memory Software timers

Basics An event is an abstraction to represent steps performed by a process Each process has a local clock, which may drift Synchronous systems: Each action is performed within bounded amount of time (e.g., a computation step, message delivery over the network, memory operation) Asynchronous systems: Unbounded delay may be incurred. The processes may perform computation at arbitrarily different “rates”. Messages may be delayed for unbounded intervals. Software timers

Event types in message-passing systems Compute event Send event Receive event Software timers

Ordering of Events Real time at which events occur can be used to determine the order of the events Can we infer event ordering in absence of real-time? Is real-time sufficient to infer causal dependency between events? Is it possible for event a to have affected event b ? Software timers

Happened-Before Relation “happened-before” relation defined without using real-time Notation: a  b a happened-before b Three rules for message-passing systems: Events on the same process: Events a and b occur at the SAME process, and a occurs before b, then a  b If a = Send(m) event and b = Receive(m) events then a  b Transitivity: if a  b and b  c then a  c Software timers

Events Occurring at Three Processes a  b Why?

Events Occurring at Three Processes a  b Why? b  c Why?

Events Occurring at Three Processes a  b Why? b  c Why? a  f Why?

Events Occurring at Three Processes a  b Why? b  c Why? a  f Why? a  e ????

Happened-Before If a  b and b  a then a and b are (logically) concurrent events Notation: a || b Concurrent events are not causally related Software timers

Identify concurrent events

Ordering of events Need some mechanism to track the ordering of events in the program without using real-time Logical timestamps useful for this Lamport introduced the logical clock mechanism Software timers

Logical Clock (Lamport Clock) Each process Pi maintains a logical clock Li Intialialize Li = 0 at the start of the process We will describe how timestamps are updated for each type of event separately Software timers

Logical Clock (Lamport Clock) Compute event at process Pi: Increment Li by 1 New value of Li is the timestamp of the compute event Software timers

Lamport Timestamps Each event is assigned a scalar timestamps

Logical Clock (Lamport Clock) Compute event at process Pi: Increment Li by 1 New value of Li is the timestamp of the compute event Send event at process Pi: Consider e = send(m) New value of Li is the timestamp of send event e Piggyback the timestamp of e with message m Software timers

Lamport Timestamps Each event is assigned a scalar timestamps

Logical Clock (Lamport Clock) Compute event at process Pi: Increment Li by 1 New value of Li is the timestamp of the compute event Send event at process Pi: Consider e = send(m) New value of Li is the timestamp of send event e Piggyback the timestamp of e with message m Receive event at process Pi: Suppose (m,t) where m is a message, and t is the piggybacked timestamp, is received at event e at Pi Update Li as Li := max(Li, t)+1 Software timers

Lamport Timestamps

Find the Mistake p 1 p 2 p 3 p 4 Physical Time Clock Value Message 1 2 3 1 4 p 2 3 2 2 3 6 p 3 4 3 5 6 8 4 7 p 4 5 6 7 n Clock Value Find the Mistake timestamp Message

Corrected Example: Lamport Logical Time Physical Time p 1 1 2 8 7 1 8 p 2 3 2 2 3 6 p 3 4 3 5 9 10 4 7 p 4 5 6 7 n Clock Value timestamp Message

Properties of Lamport Clock L(a) denotes Lamport or Logical timestamp of event a If a  b then L(a) < L(b) However, L(b) > L(a) does not imply that a  b Software timers

Properties of Lamport Clock Physical Time p 1 1 2 8 7 1 8 p 2 3 2 2 3 6 p 3 4 3 5 9 10 4 7 p 4 5 6 7 n Clock Value IDENTIFY CONCURRENT EVENTS timestamp Message

Vector Logical Clocks With Lamport Logical Timestamp e  f  timestamp(e) < timestamp (f), but timestamp(e) < timestamp (f)  {e  f} OR {e and f concurrent} Vector Logical time addresses this issue:

Vector Logical Clocks With Lamport Logical Timestamp e  f  timestamp(e) < timestamp (f), but timestamp(e) < timestamp (f)  {e  f} OR {e and f concurrent} Vector Logical time addresses this issue: Each process maintains a vector clock, length = number of processes

Vector Logical Clocks With Lamport Logical Timestamp e  f  timestamp(e) < timestamp (f), but timestamp(e) < timestamp (f)  {e  f} OR {e and f concurrent} Vector Logical time addresses this issue: Each process maintains a vector clock Vi, length = number of processes At each event, process i increments ith element of vector Vi  The new Vi is the timestamp of the event

Vector Timestamps Vector clocks initialized to all-0 vector at each process Initial value: (0,0,0)

Vector Logical Clocks With Lamport Logical Timestamp e  f  timestamp(e) < timestamp (f), but timestamp(e) < timestamp (f)  {e  f} OR {e and f concurrent} Vector Logical time addresses this issue: Each process maintains a vector clock, length = number of processes At each event, process i increments ith element of vector Vi  The new Vi is the timestamp of the event A message carries the Send event’s vector timestamp

Vector Logical Clocks With Lamport Logical Timestamp e  f  timestamp(e) < timestamp (f), but timestamp(e) < timestamp (f)  {e  f} OR {e and f concurrent} Vector Logical time addresses this issue: Each process maintains a vector clock, length = number of processes At each event, process i increments ith element of vector Vi  The new Vi is the timestamp of the event A message carries the Send event’s vector timestamp For a receive(message) event at process k … let Vmessage denote vector timestamp received with the message Max(Vk[j] , Vmessage[j]), if j is not k Vk[j] + 1 j = k Vk[j] =

Vector Timestamps Piggybacked timestamp for message m1 (2,0,0) (2,2,0)

Example: Vector Timestamps Physical Time (1,0,0,0) 1,0,0,0 1,1,0,0 2,0,0,0 2,0,1,0 (2,0,0,0) 4,0,2,2 4,2,4,2 (4,0,2,2) p 1 0,0,0,0 2,0,2,2 3,0,2,2 (2,0,2,2) p 2 1,2,0,0 2,2,3,0 (1,2,0,0) 0,0,0,0 p 3 2,0,2,0 2,0,2,1 (2,0,2,0) 0,0,0,0 2,0,2,3 4,2,5,3 (2,0,2,3) p 4 0,0,0,0 n,m,p,q Vector logical clock (vector timestamp) Message

Comparing Vector Timestamps VT1 = VT2, iff VT1[i] = VT2[i], for all i = 1, … , n VT1 < VT2, iff VT1[i] < VT2[i], for all i = 1, … , n iff VT1 < VT2 &  j (1 < j < n & VT1[j] < VT2 [j]) Then: VT1 is concurrent with VT2 iff (not VT1 < VT2 AND not VT2 < VT1)

The vector clock length equals number of processes. Can shorter vectors suffice? In general, for vector clocks, the number of elements must equal the number of processes.

Causality If a happened before b, then b “potentially causally depends” on b Potential causality

Summary Physical and Logical clocks Lamport (Logical) & vector timestamps Happened-before relation Causality