In what may be the most common client/server model a client sends an NTP message to one or more servers and processes the replies as
received. The server interchanges addresses and ports, overwrites certain fields in the message, recalculates the checksum and returns
the message immediately. Information included in the NTP message allows the client to determine the server time with respect to local
time and adjust the local clock accordingly. In addition, the message includes information to calculate the expected timekeeping
accuracy and reliability, as well as select the best from possibly several servers.
While the client/server model may suffice for use on local nets involving a public server and perhaps many workstation clients, the
full generality of NTP requires distributed participation of a number of client/servers or peers arranged in a dynamically
reconfigurable, hierarchically distributed configuration. It also requires sophisticated algorithms for association management, data
manipulation and local-clock control. Throughout the remainder of this document the term host refers to an instantiation of the
protocol on a local processor, while the term peer refers to the instantiation of the protocol on a remote processor connected by a
network path.
Figure 1 shows an implementation model for a host including three processes sharing a partitioned data base, with a partition
dedicated to each peer, and interconnected by a message-passing system. The transmit process, driven by independent timers for each
peer, collects information in the data base and sends NTP messages to the peers. Each message contains the local timestamp when the
message is sent, together with previously received timestamps and other information necessary to determine the hierarchy and manage
the association. The message transmission rate is determined by the accuracy required of the local clock, as well as the accuracies of
its peers.
The receive process receives NTP messages and perhaps messages in other protocols, as well as information from directly connected
radio clocks. When an NTP message is received, the offset between the peer clock and the local clock is computed and incorporated into
the data base along with other information useful for error determination and peer selection. A filtering algorithm described in
Section 4 improves the accuracy by discarding inferior data.
The update procedure is initiated upon receipt of a message and at other times. It processes the offset data from each peer and
selects the best one using the algorithms of Section 4. This may involve many
observations of a few peers or a few observations of many peers, depending on the accuracies required.
The local-clock process operates upon the offset data produced by the update procedure and adjusts the phase and frequency of the
local clock using the mechanisms described in Section 5. This may result in either a step-change or a
gradual phase adjustment of the local clock to reduce the offset to zero. The local clock provides a stable source of time information
to other users of the system and for subsequent reference by NTP itself.
|
|