Chap 5
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Chap 5






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Chap 5 Presentation Transcript

  • 1. Chapter-5 Synchronization
  • 2.
    • Introduction
      • A DS consists of a collection of distinct processes that are separated spatially and run concurrently
      • Sharing of resources may be co-operative or competitive.
      • The rules for enforcing correct interaction are implemented in the form of synchronization.
      • The number of resources in a computing system is restricted , one process must influence the action of other concurrently executing processes as it competes for resources.
      • The synchronization mechanisms suitable for distributed system are
      • Clock synchronization
      • Event ordering
      • Mutual exclusion
      • Election algorithm
  • 3.
    • Clock synchronization issues
      • Practically no two clocks can be perfectly synchronized
      • A set of clocks are said to synchronized if their clock skew less than some constant(∂)
      • Clock synchronization requires each node to read other nodes’ clock
      • Time must never run backward
    • Clock synchronization algorithms
      • Broadly classified into two types
      • Centralized algorithms
      • Distributed algorithms
    • Centralized algorithms
      • In this mechanism, one node has a real time receiver. This node is called TIME SERVER NODE and clock time of this node is used as a reference.
      • The clocks of all other nodes are synchronized with respect to time server node
      • Two types of clock synchronizations ( Active, Passive )
  • 4.
    • Passive time server centralized algorithms
      • In this method. Each node periodically sends a message to the time server
      • When the time server receives the message, it quickly responds with current TIME message (T)
      • Unpredictable variation of message passing duration effects on ‘T’
      • Message passing duration is considered based on a threshold value.
    • Active time server centralized algorithms
      • In this scheme, the time server periodically broadcasts it clock time.
      • The other nodes receive the broadcast message and use the clock time in the message for correcting their own clocks.
      • Each node has a priori knowledge of the propagation delay
    • Disadvantages
      • These are subject to single point failure – Time server fails, synchronization cannot be performed
      • Makes system unreliable
      • Not supports scalability (difficult)
      • Propagation delay is unpredictable
  • 5.
    • Distributed algorithms
      • Externally synchronized clocks are also internally synchronized
      • Each node of the system are synchronized wrt real-time server
      • Multiple real-time clocks are used
    • Global averaging
      • The clock process at each node broadcasts its local clock time in the form of ‘resync’ message (Resynchronization)
      • It takes the average of the estimated skews and use it as the correction for the local clock
      • The estimated skew is compared with threshold value
      • It discards highest and lowest estimated skews
      • Calculates the average of the remaining skews
    • Localized averaging
      • In this approach, all the nodes of the distributed system are logically arranged in some pattern ( Ring, grid, etc)
      • Periodically, each node exchanges its clock time with its neighbors in the ring or grid
      • Set the clock time to the average of its own and clock times of neighbor
  • 6.
    • Event ordering
      • For most applications it is not necessary and difficult to keep the clocks in a distributed system synchronized.
      • It is sufficient to ensure that, all events that occur in a DS be totally ordered in a consistent manner with an observed behavior.
      • For partial ordering of events Happened-Before and logical clocks relation is used.
    • Happened-Before relation
      • The happened-before relation (  )on a set of events satisfies
      • If a and b are events in the same process and a occurs before b, then a  b.
      • If a is the event of sending message to b, and b is the event of receiving from a then a  b
      • Satisfies Causality- A receiver cannot receive a message until the sender sends it.
      • The propagation delay is always positive
      • If a  b and b  c, the a  c (transitive law)
      • It is irreflexive a  a
      • if a and b are said to be concurrent, then a  b is not possible.
  • 7.
    • Example:
    e10 e13 e12 e11 e24 e23 e22 e21 e20 e30 e31 e32 Some happened relation are: e11  e23 , e21  e13, e30  e22, e24  e32 e30  e24 (e30  e22  e24) Some concurrent events e12 and e20, e21 and e30, e10 and e30, e11 and e31, e12 and e32, e13 and e22
  • 8.
    • Logical clocks concept
      • It is a way to associate a timestamp (a number independent of any clock time) with each system event so that events that are related to each other by happened-before relation can be properly ordered.
      • Each process Pi has a clock Ci associated with a number Ci(a) to any event a
    • Conditions
      • If a and b are two events within the same process Pi and a occurs before b , then Ci(a)<Ci(b)
      • If a is sending a message by Pi and b is the receipt of that message by process Pj , then Ci(a)<Cj(b)
      • A clock of Ci associated with process Pi must always go forward
    • Implementation of logical clocks using counters
      • The counters acts as logical clocks
      • At beginning, counters are initialized to zero
      • A process increments its counter by 1 whenever an event occurs
      • For receiving message, the counter value should always greater than the counter value of sender