Download presentation
Presentation is loading. Please wait.
1
Basics of Distributed Systems
Chien-Chung Shen CIS/UD
3
Introduction Concept of time is fundamental to our way of thinking
Derived from the basic concept of (temporal) order in which events occur A distributed system consists of a collection of distinct processes which are spatially separated no shared memory interact via message passing A system is distributed if the message transmission delay is not negligible (and not deterministic) Clocks are not (easily to be) synchronized in distributed systems hard to tell which event occurs first
4
Introduction How to define happened-before relationship between events? The happened-before relationship defines a partial order between (certain) events Design a distributed algorithm for extending the happened-before relation to a consistent total ordering of all the events Total order is an ordering that defines the exact order of every event Partial order defines the order between certain events that depend on each other
5
Causality Causality - the cause precedes the effect
Sending of a message precedes the receipt of the message Types of events in distributed systems local computation sending a message receive a message Distributed systems are causal How to define happened-before relationship between events is a distributed system without using (physical) clocks?
6
Logical Time and Clocks
The order of events each process consists of a sequence of events - two events occurred in the order they appear in a process event of sending occurred before event of receiving Happened-before relation (denoted by H) HB1: on process p: x occurred before y, then x H y HB2: For any message m, send(m) H receive(m) HB3: If x, y and z are events such that x H y and y H z, then x H z Two events a and b are concurrent if not(a H b) and not(b H a) The order of events occurring at different processes can be critical in a distributed application. To determine the order of the events that occur at different processes in a distributed application, two obvious points are: If two events occurred at the same process, then they occurred in the order in which it observes them. Whenever a message is sent between processes, the event of sending the message occurred before the event of receiving the message. The ordering obtained by generalizing these two relationships is called happen-before relation. We write x p y if two events x and y occurred at a single process p and x occurred before y. Using this restricted order we can define the happened-before relation, denoted by , as follows: HB1: If process p: x p y, then x y. HB2: For any message m, send(m) rcv(m), where send(m) is the event of sending the message, and rcv(m) is the event of receiving it. HB3: If x, y and z are events such that x y and y z, then x z.
7
time Space-Time diagram p3 and q3 p1 and r4
9
Logical Timestamps Example
Events occurring at three processes If x y, then we can find a series of events occurring at one or more processes such that either HB1 or HB2 applies between them. The sequence of events need not be unique. If two events are not related by the relation (I.e., neither a b nor b a), then they are concurrent (a || b). a b c d f; e f but a || e.
10
Lamport’s Logical Clock Alg.
11
Lamport Timestamps Example
Events occurring at three processes 2 3 => 7 1 6 4 3 1 5
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.