Download presentation
Presentation is loading. Please wait.
Published byKenneth Nichols Modified over 8 years ago
1
CS533 Concepts of Operating Systems Class 8 Time, Clocks, and the Ordering of Events in a Distributed System By Constantia Tryman
2
CS533 - Concepts of Operating Systems 2 What will be covered Concept of events ordering in distributed system Synchronization of logical clocks to order events totally Specialized synchronization using physical clocks Bound on how far synchrony clocks can drift apart
3
CS533 - Concepts of Operating Systems 3 Partial Ordering : “happened before” Definition: o If a and b are events from Pi, a comes before b then a b (same process) o If a is sending message m by Pi and b is receiving m by Pj then a b (b/t 2 processes) o If a b and b c, then a c (1 or more processes) “space-time” diagram o Horizontal: space o Vertical: time o Wavy lines: message
4
CS533 - Concepts of Operating Systems 4 Space-time Diagram
5
CS533 - Concepts of Operating Systems 5 Logical Clocks Clock: a way of assigning number to an event Logical Clock: order in which events occur Ci : define clock Ci to process Pi for event a System of clock represented by: C = Cj
6
CS533 - Concepts of Operating Systems 6 Space-Time diagram
7
CS533 - Concepts of Operating Systems 7 Clock Condition Clock Condition (CC): For events a,b: if a b then C C Converse condition will not hold => concurrent events happen at the same time CC is satisfied by: o C1: if a & b are events by Pi, a comes before b, then Ci Ci o C2: if a sends message m by Pi, b is a receipt of m by Pj, then Ci Cj
8
CS533 - Concepts of Operating Systems 8 Implementation Rule To guarantee that system of clocks satisfies CC IR1: Each process Pi increments Ci between any two successive events (tick is occurring between P’s events) IR2: (each message contains Tm = time msg sent) o A. if a is sending message m by Pi then m contains timestamp Tm = Ci o B. upon receiving m, Pj sets Cj its present value and Tm IR1 and 2 imply that CC is satisfied
9
CS533 - Concepts of Operating Systems 9 Ordering Events Totally Define : If event a in Pi and b in Pj then a b if either Ci Cj or Ci = Cj and Pi < Pj a b means Ci Cj extends
10
CS533 - Concepts of Operating Systems 10 Total Ordering of Events Algorithm for solving mutex problem: I. Process which granted the resource must release before granting resource to another Process II. Different requirements for resource must be granted in order they’re made III. Every Process granted with resource will eventually release it so every request is eventually granted Issue: doesn’t tell which Process granted if request resource concurrently with another Process
11
CS533 - Concepts of Operating Systems 11 Scheduling Issue Cannot be solved by Central Scheduling Process Ex: P 1 requests P 0, P 1 sends message P 2, P 2 requests P 0 If P 2 is granted first, violate II (granted in the order they make)
12
CS533 - Concepts of Operating Systems 12 Algorithm Rules 1) Resource Request by Pi o Pi sends message, M: “Tm: Pi request resource” to every Processes o Pi puts message M to its request Queue 2) When Message Received by Pj o Pj places M on request Queue o Sends acknowledgement message to Pi 3) Releasing Resource o Pi removes any M from request Queue o Pi sends message, M 3 : “Tm 3 : Pi releases resource” to every Processes
13
CS533 - Concepts of Operating Systems 13 Algorithm Rules Cont. 4) When Pj received Pi release resource o Removes any M: “Tm: Pi requests resource” from request Queue 5) Pi is granted the resource i. M in request Queue ordered before any other requests defined by ii. Pi has received M 2 from every other process time stamped Tm 2 (where Tm 2 Tm)
14
CS533 - Concepts of Operating Systems 14 Anomalous Behavior Resource scheduling algorithm ordered request by total ordering will result in Anomalous Behavior Strong Clock Condition: event a,b in : if a b then C C : events in all systems uses physical clocks to eliminate anomalous behavior
15
CS533 - Concepts of Operating Systems 15 Physical Clocks Ci(t): reading of clock Ci at physical time t dCi(t)/dt = rate of clock is running 1 PC1: a constant K << 1 such that i: | dCi(t)/dt - 1 | < k, where k 10 -6 PC2: i,j: |Ci(t) – Cj(t)| <
16
CS533 - Concepts of Operating Systems 16 Physical Clocks Cont. a b Cj = t, Cj = t + shortest transmission time for interprocess messages i,j,t Cj (t+ ) – Ci (t) > 0 By PC1 Ci (t+ ) – Ci (t) > (1 - k) By PC2 Ci (t+ ) – Cj (t) > 0 if / (1-k)
17
CS533 - Concepts of Operating Systems 17 Implementation Rules IR1’: i if Pi doesn’t receive a message at physical time t then Ci is differentiable at t and dCi(t)/dt 0 IR2’ a. If Pi sends message M at physical time t, then M contains Tm = Ci(t) b. Upon receiving M at time t’ Pj sets Cj(t’) = max ( Cj(t’ – 0), Tm + m )
18
CS533 - Concepts of Operating Systems 18 Theorem Theorem: Assume strongly connected graph of Processes with diameter d obeying IR1’ and IR2’ Assume m, m for constant and t t 0 a) PC1 holds b) constant and such that every seconds a message sent over every arch ( m ) PC2 is satisfied by: d (2k + ) t ≳ t 0 + d Assumption: + ≪
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.