title: Berkeley Algorithm - Distributed Systems
body: <p>So i was trying to solve this exercise about the Berkeley Algorithm:</p>
  
  <p>Illustrate how Berkeley algorithm works in the following situation. There are a group of computers requiring internal synchronization.  One master computer S and the five other slaves computers P1, P2, P3, P4 and P5.  Master computer periodically polls the slave computers and receives the timestamp from the slaves. Master multicast its request to slaves at 11:11:5.129 (hr:min:sec:ms), and the round trip time S observed for all slaves are 10ms for P1, 12ms for P2, 16ms for P3, 20ms for P4 and 16ms for P5.  The timestamp carried by P1 is 11:11:3.200, by P2 is 11:11:1.500, by P3 is 11:11:5.600, by P4 is 11:11:10.000 and by P5 is 11:11:22.200. Master S will discard the timestamps from faulty clocks whose reading differ from other clocks by more than 10 seconds. What is the average time S computed? What is the offset for each of these five slave nodes? </p>
  
  <p>This is what I could do based on some lecture notes that I found on the internet:</p>
  
  <p>Average = (5.129 + 3.2 + 1.5 + 5.6 + 10)/5 = 5.0658
  Offsets:
  S: -0.0632
  P1: +1.8658
  P2: +3.5658
  P3: -0.5342
  P4: -4.9342
  P5: -17.1342</p>
  
  <p>The lectures didn't say nothing about RTT times, so I was wondering if I should use them to solve this exercise. So, what exactly should I do?</p>