Distributed computing time

  • 80 views
Uploaded on

Distributed Computing,Time and Global States

Distributed Computing,Time and Global States

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
80
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TIME AND GLOBAL STATES Deepak John Department Of Computer Applications,SJCET-Pala
  • 2. IntroductionIntroduction  Time is an Important and interesting issue in distributes systems. One we can measure accurately. Can use as a metric.y  Consistency of distributed data, transactions, authenticity checks (ticket lifetimes),duplication detection, distributed debugging and b d t ti tgarbage detection, etc.  A device that count oscillations occurring in a crystal at a definite frequencyq y  Hardware time: Hi(t)  The counts of oscillation since an original point S ft ti C ( ) H ( )+ Software time: Ci(t) = Hi(t)+  Timestamp of an event
  • 3. Clock skew and clock drift  l k kClock skew Instantaneous difference between readings of any two clocks Clock drift Variations in how clocks count time (oscillations in a crystal), which cause divergence between clocks Network
  • 4. Clock synchronization using a time server: Cristian’s method mr mt p Time server,S Periodically, each machine sends a message to the time server asking for the current timeg Machine responds with CUTC as fast as it can
  • 5. The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 6. 1 The master polls the slaves’ clocks The Berkeley algorithms 1. The master polls the slaves’ clocks 2. The master estimates the slaves’ clocks by round-trip time  Similar to Christian’s algorithmg 3. The master averages the slaves’ clock values  Cancel out the individual clock’s tendencies to run fast or lslow 4. The master sends back to the slaves the amount that the slaves’ clocks should adjust by  Positive or negative value  Avoid further uncertainty due to the message transmission timetime  Slave adjust its clock
  • 7. NTP: The Network Time Protocol- Mills  To provide a service enabling clients across the internet to be synchronized accurately to UTC  NTP employs techniques for filtering of timing data and it discriminates between the quality of timing data from differentdiscriminates between the quality of timing data from different servers.  To provide a reliable service that can survive lengthy losses of connectivity:  There are redundant servers and redundant paths between servers; server can reconfigure in case of failuresserver can reconfigure in case of failures.  scale to large number of clients and servers  To provide protection against interference with the time service To provide protection against interference with the time service whether accidental or malicious
  • 8.  Hierarchical structure for the time servers  NTP servers synchronize with each other in one of three modes: in the order of accuracy. 1. Multicast mode  Intend for use on a high speed LAN Intend for use on a high speed LAN  Assuming a small delay  Low accuracy but efficient 2. Procedure-call mode  Similar to Christian’s  Higher accuracy than multicast Higher accuracy than multicast 3. Symmetric mode  The highest accuracyg y  Reconfigure when servers become unreachable
  • 9. An example synchronization subnet in an NTP implementation 1 Primary servers are connected to a time source, 2 2 Secondary servers are synchronized with primary servers. 3 3 3 p y Note: Arrows denote synchronization control, numbers denote strata.
  • 10. Messages exchanged between a pair of NTP peers All messages use UDP and so deliver unreliably. Each message carries three time stamps: sent time, recd time, time of this message. Ti-1Ti-2Server B Time g m m' TiTi- 3Server A Time
  • 11. Logical Time and logical ClockLogical Time and logical Clock  Logical time is an alternative; it gives ordering of events, rather than exact timestamp of occurrence.  Happen-before relation (→) is a partial order on events that reflects a flow of information between them. Th l f ‘H B f ’ l ti Three rules for ‘Happen Before’ relation. The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 12. Logical clocks (LC)Logical clocks (LC)  Logical clock is a monotonically increasing software counter that is updated according to the happened-before relationship between tevents.  Each process pi has a logical clock Li, which can be used to apply logical timestamps to events.logical timestamps to events.  Rules or Lamports algorithm for logical clocks:The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 13. Events occurring at three processes The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 14. Lamport timestamps  e  e`  L(e) < L(e`)  L(e) < L(e`)  e  e` or e||e` L(e) L(e )  e  e or e||e The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 15. Vector Clock  A vector clock for a system of N processes is an array of N integersy p y g  Each process keeps its own vector clock Vi, which it uses to timestamp local event  Processes piggyback vector timestamps on the messages they send Processes piggyback vector timestamps on the messages they send to one another
  • 16. Global StateGlobal State  The global state of a distributed computation is the set of local states of all individual processes involved in the computation plus the state of the communication channels.  The set of local states for a global set called the “cut”. A cut represents the last event that has been recorded for each of severalrepresents the last event that has been recorded for each of several processes.  All recorded message receipts have a corresponding recorded send event
  • 17. A cut C is consistent if for each event it contains all the events that happened-before(HB) that event. An inconsistent cut would have a receipt of a message but no corresponding send event. A consistent global state is one that corresponds to a consistent cut p1 e 1 0 e 1 1 e 1 2 e 1 3 A consistent global state is one that corresponds to a consistent cut. m1 m2 p2 Physical p2 time Inconsistent cut e 2 0 e 2 1 e 2 2 Consistent cut Inconsistent cut
  • 18.  Distributed garbage collection Requirements of global states  Based on reference counting  Should include the state of communication channels.  referring object may be in a message in transit referring object may be in a message in transit. The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
  • 19.  Distributed deadlock detection  Look for “waits-for” relationship  Distributed termination detection.detection.  consider a system where each process is active or passive. h k b we check processes one-by- one; has the system terminated if all are passive?p  p2 is passive but there is a message for p1 in transit Distributed debuggingDistributed debugging Need collect values of distributed variables at the same time
  • 20. Chandy and Lamport’s Snapshot Algorithm  Assume the distributed system can be represented as a collection of Assume the distributed system can be represented as a collection of processes connected to each other through uni-directional point-to- point communication channels.  the algorithm may be initiated by any process. Consider two processes P and Q  P records its own local state P records its own local state  It sends a marker along each of its outgoing channels, indicating that the receiver should participate in recording the global state.  When process Q receives the marker through an incoming channel C, its action depends on whether or not it has already saved its local statesaved its local state
  • 21. Marker receiving rule for process pi On pi’s receipt of a marker message over channel c: if ( h t t d d it t t ) itif (pi has not yet recorded its state) it records its process state now; records the state of c as the empty set; turns on recording of messages arriving over other incoming channels; else pi records the state of c as the set of messages it has received over c since it saved its state. end ifend if Marker sending rule for process pi After pi has recorded its state, for each outgoing channel c: p sends one marker message over cpi sends one marker message over c (before it sends any other message over c).