Chap 5

2,458 views

Published on

Published in: Education, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,458
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
79
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Chap 5

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

×