Unix Tip: What is NTP?
Send in your Unix questions today!
See additional Unix tips and tricks
For some of us, the word "synchronize" brings up memories of the characters
on Mission Impossible synchronizing their watches so that they can complete
a seemingly impossible mission with split-second accuracy. While time
synchronization on computer systems seems far less dramatic, it is no less
critical. Time differences between systems running a complex application can
lead to some very troublesome problems -- such as when these time differences
make transactions appear to have happened out of order. To avoid this kind
of problem, a number of solutions for keeping system clocks in synch, have
been devised. NTP is the larges scale and most effective of these.
NTP, however, isn't just about synchronizing systems with each other. NTP is
about setting system clocks accurately. When derived from the most accurate
clocks in the world, after all, the time on systems on a network -- all
getting time ticks from an accurate time keeper -- will be both accurate and
synchronized.
Time Accuracy
Before we delve into the network time protocol, let's consider what it means
for a clock to be accurate and just how accurate a clock can be.
The most accurate time measurement devices available today are atomic clocks.
More reliable than the movement of the stars, these clocks rely on the
oscillation of the nucleus and electrons of an atom to measure a unit of time.
To get a picture of what time accuracy means, let's consider a simple analogy.
When I was a kid, I was told that the way to measure seconds was to preceed
each number with the word "Mississippi". So, I would count "Mississippi-1,
Mississippi-2, Mississippi-3" and so on. Just counting "one, two, three" and
so on wouldn't be accurate, my teachers told me, because I would say these
words too quickly making each of my seconds far too short. Mississippi worked
quite well for me. In fact, I sometimes still count seconds in this way. If
I count to 20 using the Mississippi Method, I am probably not off more than
5-10%. So, at the end of my alleged twenty seconds, maybe only 18 or as many
as 22 seconds have actually passed. That's fine for hide and seek, but it
probably doesn't cut it when we're timing synapses in the brain to analyze
some nervous system dysfunction or tracing the sequence of operations in a
security attack on our network.
What we need to measure a unit of time with great accuracy is a some mechanism
for measuring each second so closely that, at the end of a week, month or year
we still wouldn't be off by more than a couple seconds. One way to do this is
by finding something that occurs in time with extremely reliable precision.
The time it takes me to drive to work? Not even close. The time it takes a
golf ball to drop from the top of the Empire State Building to the street
below? Better, but dangerous. The time that it takes an atom to complete an
oscillation? Ah, we're getting there!
The particular frequency of the oscillations in an atomic clock is determined
by the mass of the nucleus and the gravity or "electronic spring" between the
nucleus and the electron cloud around it. These oscillations are reminiscent
of the pendulum of a grandfather clock, but they happen at an alarming
frequency -- more than 9 billion times per second.
While atomic clocks can use cesium, hydrogen or rubidium atoms, the cesium
clocks are the most accurate. Some of these clocks are accurate to five parts
in ten to the 15th power. That's five parts in 10,000,000,000,000,000. That
isn't perfect, of course. But if we lose one second in 6 million years, not
many people are going to notice.
Synchronizing Networks
NTP, which stands for "network time protocol", synchronizes the clocks on
systems and routers all over the world. The National Institute of Standards
and Technology (NIST) estimates that there are between 10 and 20 million NTP
servers and clients in the world.
Synchronized to an NTP server, systems on a network are as close in time as
their connection to their source of accurate time information allows. On a
wide area network (WAN), systems may be tens of milliseconds off. On a local
area network, the difference may be much smaller than a millisecond.
Atomic Clocks and NTP Servers
Most systems running NTP -- either an NTP daemon such as ntpd or a command
such as ntpdate which adjusts the system time when it is run -- do not
synch up to an atomic clock but to an NTP server that itself gets accurate
time information from an atomic clock or another NTP server. In order to
make the NTP system work well, servers fall into a hierarchy in which each
tier of servers is further from the original source of timing information.
Primary and Secondary Servers
Primary servers are those that synchronize to the time standards using radio,
satellite or modem. Secondaries synchronize to the primaries. Tertiaries
synchronize to the primaries and so on.
Secondaries allow thousands of systems to synchronize, keeping them from
overloading the primary servers and distributing accurate time to the much
of the Internet.
Organizations connected to the Internet can then, in turn, set up tertiary
servers to provide time information to their own networks.
What time is it?
If you'd like to know what time it is in any state in the US right now, you
can browse over to http://www.time.gov and click on the state of your choice. Of course, with only eight time zones to choose from (the map also includes places like Guam and Puerto Rico), you don't have to click on your own
particular state -- just any state in the correct time zone.
ITworld.com
Essential JavaFX
Get started building rich Web apps quickly with an introduction to the power of JavaFX key features -- scene node graphs, nodes as components, the coordinate system, layout options, colors and gradients, custom classes with inheritance, animation, binding, and event handlers.Enter now!
The Nomadic Developer
Consulting can be hugely rewarding, but it's easy to fail if you are unprepared. To succeed, you need a mentor who knows the lay of the land. Aaron Erickson is your mentor, and this is your guidebook. Enter now!












