ArticleslgStudy

computer science

Clock synchronization

Clock synchronization is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Clock synchronization rather than just read about it. In short: In computer science and electrical engineering, clock synchronization is a technique for coordinating multiple independent electronic clock signals. All clocks are susceptible to deviation in their timing from a reference clock, a phenomenon called clock drift.

Key takeaways

  • Clock synchronization belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Clock synchronization to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Clock synchronization from memory before moving on to harder problems.

Reference excerpt

In computer science and electrical engineering, clock synchronization is a technique for coordinating multiple independent electronic clock signals. All clocks are susceptible to deviation in their timing from a reference clock, a phenomenon called clock drift. Even when clocks are initially set to the same time, the effect of clock drift causes individual clocks to count time at slightly different rates, with the difference accumulating over time. There are several problems that occur as a result of clock rate differences and several solutions, some being more acceptable than others in certain contexts.

Terminology In serial communication, clock synchronization can refer to clock recovery, which achieves frequency synchronization, as opposed to full phase synchronization. Such clock synchronization is used in synchronization in telecommunications and automatic baud rate detection. Plesiochronous or isochronous operation refers to a system with frequency synchronization and loose constraints on phase synchronization. Synchronous operation implies a tighter synchronization.

Problems As a result of the difficulties managing time at smaller scales, there are problems associated with clock skew that take on more complexity in distributed computing systems where multiple physically separated computers need to realize the same global time. For instance, in Unix systems, the make command is used to compile new or modified code and seeks to avoid recompiling unchanged code. The make command uses the clock of the machine it runs on to determine which source files need to be recompiled. If the sources reside on a separate file server and the two machines have unsynchronized clocks, the make program might not produce the correct results. Synchronization is required for accurate reproduction of streaming media. Clock synchronization is a significant component of audio over Ethernet systems.

Solutions In a system with a central server, the synchronization solution is trivial; the server will dictate the system time. Cristian's algorithm and the Berkeley algorithm are potential solutions to the clock synchronization problem in this environment. In distributed computing, the problem takes on more complexity because a global time is not easily known. The most used clock synchronization solution on the Internet is the Network Time Protocol (NTP), which is a layered client-server architecture based on User Datagram Protocol (UDP) message passing. Lamport timestamps and vector clocks are concepts of the logical clock in distributed computing. Implementing clock synchronization through wireless networks involves additional challenges, such as the possibility for collision of synchronization packets on the wireless medium, a higher drift rate of clocks on low-cost wireless devices.

Berkeley algorithm

The Berkeley algorithm is suitable for systems where a radio clock is not present. This system has no way of making sure of the actual time other than by maintaining a global average time as the global time. A time server will periodically fetch the time from all the time clients, average the results, and then report back to the clients the adjustment that needs be made to their local clocks to achieve the average. This algorithm highlights the fact that internal clocks may vary not only in the time they contain but also in the clock rate.

Clock-sampling mutual network synchronization Clock-sampling mutual network synchronization (CS-MNS) is suitable for distributed and mobile applications. It has been shown to be scalable over mesh networks that include indirectly-linked non-adjacent nodes and is compatible with IEEE 802.11 and similar standards. It can be accurate to the order of a few microseconds but requires direct physical wireless connectivity with negligible link delay (less than 1 microsecond) on links between adjacent nodes, limiting the distance between neighboring nodes to a few hundred meters.

Cristian's algorithm

Cristian's algorithm relies on the existence of a time server. The time server maintains its clock by using a radio clock or other accurate time source, then all other computers in the system stay synchronized with it. A time client will maintain its clock by making a procedure call to the time server. Variations of this algorithm make more precise time calculations by factoring in network radio propagation time.

Satellite navigation systems In addition to its use in navigation, the Global Positioning System (GPS) can also be used for clock synchronization. The accuracy of GPS time signals is ±10 nanoseconds. Using GPS (or other satellite navigation systems) for synchronization requires a receiver connected to an antenna with unobstructed view of the sky.

Inter-range Instrumentation Group time codes IRIG timecodes are standard formats for transferring timing information. Atomic frequency standards and GPS receivers designed for precision timing are often equipped with an IRIG output. The standards were created by the Telecommunications Working Group of the United States military's Inter-Range Instrumentation Group (IRIG), the standards body of the Range Commanders Council. Work on these standards started in October 1956, and the original standards were accepted in 1960.

Network Time Protocol Network Time Protocol (NTP) is a highly robust protocol, widely deployed throughout the Internet. Well tested over the years, it is generally regarded as the state of the art in distributed time synchronization protocols for unreliable networks. It can reduce synchronization offsets to times of the order of a few milliseconds over the public Internet and to sub-millisecond levels over local area networks. A simplified version of the NTP protocol, Simple Network Time Protocol (SNTP), can also be used as a pure single-shot stateless primary/secondary synchronization protocol, but lacks the sophisticated features of NTP, and thus has much lower performance and reliability levels.

Precision Time Protocol Precision Time Protocol (PTP) is a master/slave protocol for delivery of highly accurate time over local area networks.

Reference broadcast synchronization The Reference Broadcast Time Synchronization (RBS) algorithm is often used in wireless networks and sensor networks. In this scheme, an initiator broadcasts a reference message to urge the receivers to adjust their clocks.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Clock synchronization

Start with the simplest possible case. Write down what Clock synchronization claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Clock synchronization before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Clock synchronization ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Clock synchronization

In research
Clock synchronization appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Clock synchronization in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Clock synchronization is common in secondary-school and first-year university syllabi. It links to neighbouring topics Clocks, Distributed computing problems, Synchronization, so understanding it makes those chapters shorter.
In everyday life
Look for Clock synchronization outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Clock synchronization” →

How to study Clock synchronization in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Clock synchronization means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Clock synchronization out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Clock synchronization in simple terms?

In computer science and electrical engineering, clock synchronization is a technique for coordinating multiple independent electronic clock signals. All clocks are susceptible to deviation in their timing from a reference clock, a phenomenon called clock drift.

Why does Clock synchronization matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Clock synchronization?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Clock synchronization.

Tags

  • Clocks
  • Distributed computing problems
  • Synchronization

Keep exploring