change or when the reachability status changes. It consists of two
algorithms, the intersection algorithm and the clustering algorithm. The
intersection algorithm constructs a list of candidate peers eligible to
become the synchronization source, computes a confidence interval for
each and casts out falsetickers using a technique adapted from Marzullo
and Owicki [MAR85]. The clustering algorithm sorts the list of surviving
candidates in order of stratum and synchronization distance and
repeatedly casts out outlyers on the basis of select dispersion until
only the most accurate, precise and stable survivors are left. A bit is
set for each survivor to indicate the outcome of the selection process.
The system variable sys.peer is set as a pointer to the most likely
survivor, if there is one, or to the NULL value if not.
Intersection Algorithm
begin clock-selection procedure
Each peer is examined in turn and added to an endpoint list only if it
passes several sanity checks designed to avoid loops and use of
exceptionally noisy data. If no peers survive the sanity checks, the
procedure exits without finding a synchronization source. For each of m
survivors three entries of the form <$E[endpoint,~type]> are added to
the endpoint list: <$E[ THETA~-~LAMBDA ,~-~1]>, <$E[ THETA ,~0]> and
<$E[ THETA~+~LAMBDA ,~1]>. There will be <$E3 m> entries on the list,
which is then sorted by increasing endpoint.
<$Em~<<-~0>;
for (each peer) /* calling all peers */
if (<$Eroman {peer.reach~!=~0~bold
and~peer.dispersion~<<~NTP.MAXDISPERSE}> and
not (peer.stratum >> 1 and peer.refid =
peer.hostaddr)) begin
<$ELAMBDA~<MO>
<~>an distance (peer)>; /* make list entry */
add <$E[ THETA~-~LAMBDA ,~-1]> to endpoint list;
add <$E[ THETA ,~0]> to endpoint list;
add <$E[ THETA~+~LAMBDA ,~1]> to endpoint list;
<$Em~<<-~m~+~1>;
<B>endif
endfor
if (<$Em~=~0>) begin /* skedaddle if
no candidates */
<$Eroman sys.peer~<<-~roman NULL>;
<$Eroman sys.stratum~<<-~0~(undefined)>;
exit;