Home | History | Annotate | Line # | Download | only in html
prefer.html revision 1.1
      1  1.1  kardel <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      2  1.1  kardel <html>
      3  1.1  kardel <head>
      4  1.1  kardel <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
      5  1.1  kardel <title>Mitigation Rules and the prefer Keyword</title>
      6  1.1  kardel <link href="scripts/style.css" type="text/css" rel="stylesheet">
      7  1.1  kardel </head>
      8  1.1  kardel <body>
      9  1.1  kardel 
     10  1.1  kardel <h3>Mitigation Rules and the <tt>prefer</tt> Keyword</h3>
     11  1.1  kardel 
     12  1.1  kardel <img src="pic/alice11.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html"> from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a>
     13  1.1  kardel <p>Listen carefully to what I say; it is very complicated.</p>
     14  1.1  kardel <p>Last update: 
     15  1.1  kardel 	<!-- #BeginDate format:En2m -->22-Apr-2009  14:04<!-- #EndDate -->
     16  1.1  kardel UTC</p>
     17  1.1  kardel <br clear="left">
     18  1.1  kardel 
     19  1.1  kardel <h4>Related Links</h4>
     20  1.1  kardel 
     21  1.1  kardel <script type="text/javascript" language="javascript" src="scripts/misc.txt"></script>
     22  1.1  kardel 
     23  1.1  kardel <h4>Table of Contents</h4>
     24  1.1  kardel 
     25  1.1  kardel <ul>
     26  1.1  kardel 
     27  1.1  kardel <li class="inline"><a href="#intro">Introduction</a></li>
     28  1.1  kardel <li class="inline"><a href="#peer">Peer Classification</a></li>
     29  1.1  kardel <li class="inline"><a href="#prefer">The <tt>prefer</tt> Peer</a></li>
     30  1.1  kardel <li class="inline"><a href="#miti">Mitigation Rules</a></li>
     31  1.1  kardel <li class="inline"><a href="#mins">The <tt>minsane</tt> Option</a></li>
     32  1.1  kardel 
     33  1.1  kardel </ul>
     34  1.1  kardel 
     35  1.1  kardel <hr>
     36  1.1  kardel 
     37  1.1  kardel <h4 id="intro">Introduction</h4>
     38  1.1  kardel 
     39  1.1  kardel <p>This page summarizes the criteria for choosing from among a number of potential sources suitable contributors to the clock discipline algorithm. The criteria are very meticulous, since they have to handle many different scenarios that may be optimized for peculiar circumstances, including some scenarios designed to support planetary and deep space missions.</p>
     40  1.1  kardel 
     41  1.1  kardel <p>Recall the suite of NTP data acquisition and grooming algorithms as these algorithms proceed in five phases. Phase one discovers the available sources and mobilizes an association for each candidate found. These candidates can result from explicit configuration, broadcast discovery or the pool and manycast autonomous configuration schemes. Phase two grooms the selectable candidates excluding those sources showing one or more of the following errors</p>
     42  1.1  kardel 
     43  1.1  kardel <ol>
     44  1.1  kardel 
     45  1.1  kardel <li>A stratum error occurs if (1) the source had never been synchronized or (2) the stratum of the source is below the <tt>floor</tt> option or not below the <tt>ceiling</tt> option specified by the <tt>tos</tt> command. The default value for these options are 0 and 16, respectively.</li>
     46  1.1  kardel 
     47  1.1  kardel <li>A distance error occurs for a remote source if the root distance is not below the distance threshold <tt>maxdist</tt> option of the <tt>tos</tt> command. The default value for this option is 1.5 s for networks including only the Earth, but this should be increased to 2.5 s for networks including the Moon.</li>
     48  1.1  kardel 
     49  1.1  kardel <li>A loop error occurs if the source is synchronized to the client of if the source is synchronized to the same source as the client.</li>
     50  1.1  kardel 
     51  1.1  kardel <li>An unreachable error occurs if the source is unreachable or if the <tt>server</tt> or <tt>peer</tt> command for the source includes the <tt>noselect</tt> option.</li>
     52  1.1  kardel 
     53  1.1  kardel </ol>
     54  1.1  kardel 
     55  1.1  kardel <p>Phase three uses an intersection algorithm to select the truechimers from
     56  1.1  kardel 	among the candidates, leaving behind the falsetickers. A server or peer configured
     57  1.1  kardel 	with the <tt>true</tt> option is ipso facto a truechimer independent of this
     58  1.1  kardel 	algorithm. Phase four uses a clustering algorithm to cast off statistical outliers
     59  1.1  kardel 	from the truechimers until a set of survivors not less than the number specified
     60  1.1  kardel 	as the <tt>minclock</tt> option of the <tt>tos</tt> command, with default 3.
     61  1.1  kardel 	Phase five uses a set of mitigation rules to select from among the survivors
     62  1.1  kardel 	a system peer from which a set of system statistics can be inherited and passed
     63  1.1  kardel 	along to a dependent client population. The clock offset developed from these
     64  1.1  kardel 	algorithms can discipline the system clock either using the <tt>ntpd</tt> clock
     65  1.1  kardel 	discipline algorithm or enable the kernel to discipline the system clock directly,
     66  1.1  kardel 	as described on the <a href="kern.html">A Kernel Model for Precision Timekeeping</a> page.
     67  1.1  kardel 	Phase five is the topic of this page.</p>
     68  1.1  kardel 
     69  1.1  kardel <h4 id="peer">Peer Classification</h4>
     70  1.1  kardel 
     71  1.1  kardel <p>The behavior of the various algorithms and mitigation rules involved depends on how the various synchronization sources are classified. This depends on whether the source is local or remote and if local the type of source. The following classes are defined:</p>
     72  1.1  kardel 
     73  1.1  kardel <ol>
     74  1.1  kardel 
     75  1.1  kardel <li>An association configured for a remote server or peer is classified simply as a <i>server</i>. All other associations are classified as a <i>device driver</i> of one kind or another. In general, one or more sources of either or both types will be configured in each installation.</li>
     76  1.1  kardel 
     77  1.1  kardel <li>If all sources have been lost and the orphan stratum has been specified by the <tt>orphan</tt> option of the <tt>tos</tt> command, a pseudo-source called the <i>orphan parent</i> is created with offset and jitter both zero. Dependent orphan children will see the orphan parent as if synchronized to a  server at the orphan stratum.If the only survivor is the orphan parent, it becomes the system peer and its clock offset and jitter are inherited by the corresponding system variables. Note that by design all the orphan children having the same set of orphan parents will select the same parent.</li>
     78  1.1  kardel 
     79  1.1  kardel <li>When a device driver has been configured for pulse-per-second (PPS) signals and PPS signals are being received, it is designated the <i>PPS driver.</i> Note that the Pulse-per-Second driver (type 22) is often used as a PPS driver, but any driver can be operated as a PPS driver as well. The PPS driver provides precision clock discipline only within +-0.5 s, so is always associated with another source or sources that provide the seconds numbering function.</li>
     80  1.1  kardel 
     81  1.1  kardel <li>When the Undisciplined Local Clock driver (type 1) is configured, it is designated the <i>local driver</i>. This driver is used either as a backup source (stratum greater than zero) should all sources fail, or as the primary source (stratum zero) in cases where the kernel time is disciplined by some other means of synchronization, such as the NIST <tt>lockclock</tt> scheme, or another synchronization protocol such as the Digital Time Synchronization Service (DTSS).</li>
     82  1.1  kardel 
     83  1.1  kardel <li>When the Automated Computer Time Service driver (type 18) is configured, it is designated the <i>modem driver</i>. This is used either as a backup source, should all other sources fail, or as the (only) primary source.</li>
     84  1.1  kardel 
     85  1.1  kardel </ol>
     86  1.1  kardel 
     87  1.1  kardel <h4 id="prefer">The <tt>prefer</tt> Peer</h4>
     88  1.1  kardel 
     89  1.1  kardel <p>The mitigation rules are designed to provide an intelligent selection of the system peer from among the survivors of different types. When used with the <tt>server</tt> or <tt>peer</tt>  commands, the <tt>prefer</tt> option designates one or more survivors as preferred over all others. While the rules do not forbid it, it is usually not useful to designate more than one source as preferred; however, if more than one source is so designated, they are used in the order specified in the configuration file; that is, if the first one becomes unselectable, the second one is considered and so forth. This order of priority is also applicable to multiple PPS drivers, multiple modem drivers and even multiple local drivers, although that would not normally be useful.</p>
     90  1.1  kardel 
     91  1.1  kardel <p>The clustering algorithm works on the set of truechimers produced by the intersection algorithms. Ordinarily, any one of them can in principle provide correct time; however, due to various latency variations, not all can provide the most accurate and stable time. The clustering algorithm, processes the truechimers in one or more rounds to cast off a statistical outlier until no more than the <tt>minclock</tt> option of the <tt>tos</tt> command are left. The default for this option is 3.</p>
     92  1.1  kardel 
     93  1.1  kardel <p>In the prefer scheme the clustering algorithm is modified so that the prefer peer is never discarded; on the contrary, its potential removal becomes a rounds-termination condition. However, the prefer peer can still be discarded by the intersection algorithm as a falseticker. To avoid this, it is usually wise to increase the <tt>mindist</tt> option of the <tt>tos</tt> command from the default .005 s to something like .05 s.</p>
     94  1.1  kardel 
     95  1.1  kardel <p>Ordinarily, the combining algorithm computes a weighted average of the survivor
     96  1.1  kardel 	offsets to produce the final synchronization source. However, if a prefer
     97  1.1  kardel 	peer is among the survivors, the combining algorithm is not used. Instead,
     98  1.1  kardel 	the offset of the prefer peer is used exclusively as the final synchronization
     99  1.1  kardel 	source. In the common case involving a radio clock and a flock of remote backup
    100  1.1  kardel 	servers, and with the radio clock designated a prefer peer, the result is that
    101  1.1  kardel 	the radio clock normally disciplines the system clock as long as the radio itself
    102  1.1  kardel 	remains operational. However, if the radio fails or becomes a falseticker,
    103  1.1  kardel 	the averaged backup sources continue to discipline the system clock.</p>
    104  1.1  kardel 
    105  1.1  kardel <h4 id="miti">Mitigation Rules</h4>
    106  1.1  kardel 
    107  1.1  kardel <p>As the selection algorithm scans the associations for selectable candidates, the modem driver and local driver are segregated for later, but only if not designated a prefer peer. If so designated, a driver is included among the candidate population. In addition, if orphan parents are found the parent with the lowest  metric is segregated for later; the others are discarded. For this purpose the metric is defined as the four-octet IPv4 address or the first four octets of the hashed IPv6 address. The resulting candidates, including any prefer peers found, are processed by the intersection to produce a possibly empty set of truechimers. The clustering algorithm ranks the truechimers first by stratum then by synchronization distance and designates the survivor with the lowest distance as the potential system peer.</p>
    108  1.1  kardel 
    109  1.1  kardel <p>If one or more truechimers support a pulse-per-second (PPS) signal and the
    110  1.1  kardel 	PPS signal is operating correctly, it is designated a PPS driver. If more than
    111  1.1  kardel 	one PPS diver are found, only the first one is used. The PPS driver is not included
    112  1.1  kardel 	in the combining algorithm and is mitigated separately.</p>
    113  1.1  kardel 
    114  1.1  kardel <p>At this point we have the following contributors to the system clock discipline:</p>
    115  1.1  kardel 
    116  1.1  kardel <ul>
    117  1.1  kardel 
    118  1.1  kardel <li>(potential) system peer, if there are survivors;</li>
    119  1.1  kardel <li>orphan parent, if present;</li>
    120  1.1  kardel <li>local driver and zero offset, if present;</li>
    121  1.1  kardel <li>modem driver and modem offset, if present;</li>
    122  1.1  kardel <li>prefer peer and offset, if present;</li>
    123  1.1  kardel <li>PPS driver and offset, if present.</li>
    124  1.1  kardel </ul>
    125  1.1  kardel 
    126  1.1  kardel <p>The mitigation algorithm proceeds in three steps in turn.</p>
    127  1.1  kardel 
    128  1.1  kardel <ol>
    129  1.1  kardel 
    130  1.1  kardel <li>If there are no survivors, the modem driver becomes the only survivor if there is one. If not, the local driver becomes the only survivor if there is one. If not, the orphan parent becomes the only survivor if there is one. If the number of survivors at this point is less than the <tt>minsane</tt> option of the <tt>tos</tt> command, the algorithm is terminated and the system variables remain unchanged. Note that <tt>minsane</tt> is by default 1, but can be set at any value including 0.</li>
    131  1.1  kardel 
    132  1.1  kardel <li>If the prefer peer is among the survivors, it becomes the system peer and its clock offset and jitter are inherited by the corresponding system variables. Otherwise, the combining algorithm computes these variables from the survivor population.</li>
    133  1.1  kardel 
    134  1.1  kardel <li>If there is a PPS driver and the system clock offset at this point is less than 0.4 s, and if there is a prefer peer among the survivors or if the PPS peer is designated as a prefer peer, the PPS driver becomes the system peer and its offset and jitter are inherited by the system variables, thus overriding any variables already computed. Note that a PPS driver is present only if PPS signals are actually being received and enabled by the associated driver.</li>
    135  1.1  kardel 
    136  1.1  kardel </ol>
    137  1.1  kardel 
    138  1.1  kardel <p>If none of the above is the case, the data are disregarded and the system variables remain as they are.</p>
    139  1.1  kardel 
    140  1.1  kardel <h4 id="mins">The <tt>minsane</tt> Option</H4>
    141  1.1  kardel 
    142  1.1  kardel <p> The <tt>minsane</tt> option of the <tt>tos</tt> command, the <tt>prefer</tt> option of the <tt>server</tt> and <tt>peer</tt> commands and the <tt>flag</tt> options of the <tt>fudge</tt> command for the PPS driver can be used with the mitigation rules to provide many useful configurations. The <tt>minsane</tt> option specifies the minimum number of survivors required to synchronized the system clock. The <tt>prefer</tt> option designates the prefer peer. The driver-dependent <tt>flag</tt> options enable the PPS driver for various conditions.</p>
    143  1.1  kardel 
    144  1.1  kardel <p>A common scenario is a GPS driver with a serial timecode and PPS signal. The
    145  1.1  kardel 	PPS signal is disabled until the system clock has been set by some means, not
    146  1.1  kardel 	necessarily the GPS driver. If the serial timecode is within 0.4 s of the PPS
    147  1.1  kardel 	signal, the GPS driver is designated the PPS driver and the PPS signal disciplines
    148  1.1  kardel 	the system clock. If no GPS satellites are in view, or if the PPS signal is
    149  1.1  kardel 	disconnected, the GPS driver stops updating the system clock and so eventually
    150  1.1  kardel 	becomes unreachable and replaced by other sources..</p>
    151  1.1  kardel 
    152  1.1  kardel <p>Whether or not the GPS driver disables the PPS signal when unreachable is
    153  1.1  kardel at the discretion of the driver. Ordinarily, the PPS signal would be disabled in this case; however, When the GPS receiver has a precision holdover oscillator, the driver may elect to continue PPS operation. In this case the PPS signal continues to discipline the system clock.</p>
    154  1.1  kardel 
    155  1.1  kardel <p>&nbsp;</p>
    156  1.1  kardel 
    157  1.1  kardel <hr>
    158  1.1  kardel <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
    159  1.1  kardel 	</body>
    160  1.1  kardel 
    161  1.1  kardel </html>