|
|
1.1 ! root 1: .\" Copyright (c) 1986 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted ! 5: .\" provided that the above copyright notice and this paragraph are ! 6: .\" duplicated in all such forms and that any documentation, ! 7: .\" advertising materials, and other materials related to such ! 8: .\" distribution and use acknowledge that the software was developed ! 9: .\" by the University of California, Berkeley. The name of the ! 10: .\" University may not be used to endorse or promote products derived ! 11: .\" from this software without specific prior written permission. ! 12: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 13: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 14: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 15: .\" ! 16: .\" @(#)timed.ms 6.2 (Berkeley) 3/7/89 ! 17: .\" ! 18: .TL ! 19: Timed Installation and Operation Guide ! 20: .AU ! 21: Riccardo Gusella, Stefano Zatti, James M. Bloom ! 22: .AI ! 23: Computer Systems Research Group ! 24: Computer Science Division ! 25: Department of Electrical Engineering and Computer Science ! 26: University of California, Berkeley ! 27: Berkeley, CA 94720 ! 28: .AU ! 29: Kirk Smith ! 30: .AI ! 31: Engineering Computer Network ! 32: Department of Electrical Engineering ! 33: Purdue University ! 34: West Lafayette, IN 47906 ! 35: .FS ! 36: This work was sponsored by the Defense Advanced Research Projects Agency ! 37: (DoD), monitored by the Naval Electronics Systems ! 38: Command under contract No. N00039-84-C-0089, and by the CSELT ! 39: Corporation of Italy. ! 40: The views and conclusions contained in this document are those of the ! 41: authors and should not be interpreted as representing official policies, ! 42: either expressed or implied, of the Defense Research Projects Agency, ! 43: of the US Government, or of CSELT. ! 44: .FE ! 45: .LP ! 46: .EH 'SMM:8-%''Timed Installation and Operation' ! 47: .OH 'Timed Installation and Operation''SMM:8-%' ! 48: .SH ! 49: Introduction ! 50: .PP ! 51: The clock synchronization service for ! 52: the UNIX 4.3BSD operating system is composed of a collection of ! 53: time daemons (\fItimed\fP) running on the machines in a local ! 54: area network. ! 55: The algorithms implemented by the service is based on a master-slave scheme. ! 56: The time daemons communicate with each other using the ! 57: \fITime Synchronization Protocol\fP (TSP) which ! 58: is built on the DARPA UDP protocol and described in detail in [4]. ! 59: .PP ! 60: A time daemon has a twofold function. ! 61: First, it supports the synchronization of the clocks ! 62: of the various hosts in a local area network. ! 63: Second, it starts (or takes part in) the election that occurs ! 64: among slave time daemons when, for any reason, the master disappears. ! 65: The synchronization mechanism and the election procedure ! 66: employed by the program \fItimed\fP are described ! 67: in other documents [1,2,3]. ! 68: The next paragraphs are a brief overview of how the time daemon works. ! 69: This document is mainly concerned with the administrative and technical ! 70: issues of running \fItimed\fP at a particular site. ! 71: .PP ! 72: A \fImaster time daemon\fP measures the time ! 73: differences between the clock of the machine on which it ! 74: is running and those of all other machines. ! 75: The master computes the \fInetwork time\fP as the average of the ! 76: times provided by nonfaulty clocks.\** ! 77: .FS ! 78: A clock is considered to be faulty when its value ! 79: is more than a small specified ! 80: interval apart from the majority of the clocks ! 81: of the other machines [1,2]. ! 82: .FE ! 83: It then sends to each \fIslave time daemon\fP the ! 84: correction that should be performed on the clock of its machine. ! 85: This process is repeated periodically. ! 86: Since the correction is expressed as a time difference rather than an ! 87: absolute time, transmission delays do not interfere with ! 88: the accuracy of the synchronization. ! 89: When a machine comes up and joins the network, ! 90: it starts a slave time daemon which ! 91: will ask the master for the correct time and will reset the machine's clock ! 92: before any user activity can begin. ! 93: The time daemons are able to maintain a single network time in spite of ! 94: the drift of clocks away from each other. ! 95: The present implementation keeps processor clocks synchronized ! 96: within 20 milliseconds. ! 97: .PP ! 98: To ensure that the service provided is continuous and reliable, ! 99: it is necessary to implement an election algorithm to elect a ! 100: new master should the machine running the current master crash, the master ! 101: terminate (for example, because of a run-time error), or ! 102: the network be partitioned. ! 103: Under our algorithm, slaves are able to realize when the master has ! 104: stopped functioning and to elect a new master from among themselves. ! 105: It is important to note that, since the failure of the master results ! 106: only in a gradual divergence of clock values, the election ! 107: need not occur immediately. ! 108: .PP ! 109: The machines that are gateways between distinct local area ! 110: networks require particular care. ! 111: A time daemon on such machines may act as a \fIsubmaster\fP. ! 112: This artifact depends on the current inability of ! 113: transmission protocols to broadcast a message on a network ! 114: other than the one to which the broadcasting machine is connected. ! 115: The submaster appears as a slave on one network, and as a master ! 116: on one or more of the other networks to which it is connected. ! 117: .PP ! 118: A submaster classifies each network as one of three types. ! 119: A \fIslave network\fP is a network on which the submaster acts as a slave. ! 120: There can only be one slave network. ! 121: A \fImaster network\fP is a network on which the submaster acts as a master. ! 122: An \fIignored network\fP is any other network which already has a valid master. ! 123: The submaster tries periodically to become master on an ignored ! 124: network, but gives up immediately if a master already exists. ! 125: .SH ! 126: Guidelines ! 127: .PP ! 128: While the synchronization algorithm is quite general, the election ! 129: one, requiring a broadcast mechanism, puts constraints on ! 130: the kind of network on which time daemons can run. ! 131: The time daemon will only work on networks with broadcast capability ! 132: augmented with point-to-point links. ! 133: Machines that are only connected to point-to-point, ! 134: non-broadcast networks may not use the time daemon. ! 135: .PP ! 136: If we exclude submasters, there will normally be, at most, one master time ! 137: daemon in a local area internetwork. ! 138: During an election, only one of the slave time daemons ! 139: will become the new master. ! 140: However, because of the characteristics of its machine, ! 141: a slave can be prevented from becoming the master. ! 142: Therefore, a subset of machines must be designated as potential ! 143: master time daemons. ! 144: A master time daemon will require CPU resources ! 145: proportional to the number of slaves, in general, more than ! 146: a slave time daemon, so it may be advisable to limit master time ! 147: daemons to machines with more powerful processors or lighter loads. ! 148: Also, machines with inaccurate clocks should not be used as masters. ! 149: This is a purely administrative decision: an organization may ! 150: well allow all of its machines to run master time daemons. ! 151: .PP ! 152: At the administrative level, a time daemon on a machine ! 153: with multiple network interfaces, may be told to ignore all ! 154: but one network or to ignore one network. ! 155: This is done with the \fI\-n network\fP and \fI\-i network\fP ! 156: options respectively at start-up time. ! 157: Typically, the time daemon would be instructed to ignore all but ! 158: the networks belonging to the local administrative control. ! 159: .PP ! 160: There are some limitations to the current ! 161: implementation of the time daemon. ! 162: It is expected that these limitations will be removed in future releases. ! 163: The constant NHOSTS in /usr/src/etc/timed/globals.h limits the ! 164: maximum number of machines that may be directly controlled by one ! 165: master time daemon. ! 166: The current maximum is 29 (NHOSTS \- 1). ! 167: The constant must be changed and the program recompiled if a site wishes to ! 168: run \fItimed\fP on a larger (inter)network. ! 169: .PP ! 170: In addition, there is a \fIpathological situation\fP to ! 171: be avoided at all costs, that might occur when ! 172: time daemons run on multiply-connected local area networks. ! 173: In this case, as we have seen, time daemons running on gateway machines ! 174: will be submasters and they will act on some of those ! 175: networks as master time daemons. ! 176: Consider machines A and B that are both gateways between ! 177: networks X and Y. ! 178: If time daemons were started on both A and B without constraints, it would be ! 179: possible for submaster time daemon A to be a slave on network X ! 180: and the master on network Y, while submaster time daemon B is a slave on ! 181: network Y and the master on network X. ! 182: This \fIloop\fP of master time daemons will not function properly ! 183: or guarantee a unique time on both networks, and will cause ! 184: the submasters to use large amounts of system resources in the form ! 185: of network bandwidth and CPU time. ! 186: In fact, this kind of \fIloop\fP can also be generated with more ! 187: than two master time daemons, ! 188: when several local area networks are interconnected. ! 189: .SH ! 190: Installation ! 191: .PP ! 192: In order to start the time daemon on a given machine, ! 193: the following lines should be ! 194: added to the \fIlocal daemons\fP section in the file \fI/etc/rc.local\fP: ! 195: .sp 2 ! 196: .in 1i ! 197: .nf ! 198: if [ -f /etc/timed ]; then ! 199: /etc/timed \fIflags\fP & echo -n ' timed' >/dev/console ! 200: fi ! 201: .fi ! 202: .in -1i ! 203: .sp ! 204: .LP ! 205: In any case, they must appear after the network ! 206: is configured via ifconfig(8). ! 207: .PP ! 208: Also, the file \fI/etc/services\fP should contain the following ! 209: line: ! 210: .sp 2 ! 211: .ti 1i ! 212: timed 525/udp timeserver ! 213: .sp ! 214: .LP ! 215: The \fIflags\fP are: ! 216: .IP "-n network" 13 ! 217: to consider the named network. ! 218: .IP "-i network" ! 219: to ignore the named network. ! 220: .IP -t ! 221: to place tracing information in \fI/usr/adm/timed.log\fP. ! 222: .IP -M ! 223: to allow this time daemon to become a master. ! 224: A time daemon run without this option will be forced in the state of ! 225: slave during an election. ! 226: .SH ! 227: Daily Operation ! 228: .PP ! 229: \fITimedc(8)\fP is used to control the operation of the time daemon. ! 230: It may be used to: ! 231: .IP \(bu ! 232: measure the differences between machines' clocks, ! 233: .IP \(bu ! 234: find the location where the master \fItimed\fP is running, ! 235: .IP \(bu ! 236: cause election timers on several machines to expire at the same time, ! 237: .IP \(bu ! 238: enable or disable tracing of messages received by \fItimed\fP. ! 239: .LP ! 240: See the manual page on \fItimed\fP\|(8) and \fItimedc\fP\|(8) ! 241: for more detailed information. ! 242: .PP ! 243: The \fIdate(1)\fP command can be used to set the network date. ! 244: In order to set the time on a single machine, the \fI-n\fP flag ! 245: can be given to date(1). ! 246: .bp ! 247: .SH ! 248: References ! 249: .IP 1. ! 250: R. Gusella and S. Zatti, ! 251: \fITEMPO: A Network Time Controller for Distributed Berkeley UNIX System\fP, ! 252: USENIX Summer Conference Proceedings, Salt Lake City, June 1984. ! 253: .IP 2. ! 254: R. Gusella and S. Zatti, \fIClock Synchronization in a Local Area Network\fP, ! 255: University of California, Berkeley, Technical Report, \fIto appear\fP. ! 256: .IP 3. ! 257: R. Gusella and S. Zatti, ! 258: \fIAn Election Algorithm for a Distributed Clock Synchronization Program\fP, ! 259: University of California, Berkeley, CS Technical Report #275, Dec. 1985. ! 260: .IP 4. ! 261: R. Gusella and S. Zatti, ! 262: \fIThe Berkeley UNIX 4.3BSD Time Synchronization Protocol\fP, ! 263: UNIX Programmer's Manual, 4.3 Berkeley Software Distribution, Volume 2c.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.