27
$\begingroup$

While reading a book, I came across a paragraph given below:

In order to synchronize all of a computer’s operations, a system clock—a small quartz crystal located on the motherboard—is used. The system clock sends out a signal on a regular basis to all other computer components.

And another paragraph:

Many personal computers today have system clocks that run at 200 MHz, and all devices (such as CPUs) that are synchronized with these system clocks run at either the system clock speed or at a multiple of or a fraction of the system clock speed.

Can anyone kindly tell:

  • What is the function of the system clock? And what is meant by “synchronize” in the first paragraph?
  • Is there any difference between “system clock” and “CPU clock”? If yes, then what is the function of the CPU clock?
$\endgroup$
19
$\begingroup$

The system clock is needed to synchronize all components on the motherboard, which means they all do their work only if the clock is high; never when it's low. And because the clock speed is set above the longest time any signal needs to propagate through any circuit on the board, this system is preventing signals from arriving before other signals are ready and thus keeps everything safe and synchronized. The CPU clock has the same purpose, but is only used on the chip itself. Because the CPU needs to perform more operations per time than the motherboard, the CPU clock is much higher. And because we don't want to have another oscillator (e.g. because they also would need to be synchronized), the CPU just takes the system clock and multiplies it by a number, which is either fixed or unlocked (in that case the user can change the multiplier in order to over- or underclock the CPU).

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Awesome answer this is extremely helpful to know from an electrical engineering perspective ⚡️ 👩🏻‍💻 👨🏻‍💻 💯 $\endgroup$ – A-Dubb Dec 10 '19 at 23:36
  • $\begingroup$ @A-Dubb this answer is not accurate since it suggests that the CPU clock is always higher than the system clock which is not true. See my answer for more details where I try to provide a real perspective in terms of hardware. $\endgroup$ – bruno Jan 1 at 1:03
  • 1
    $\begingroup$ @21Brunoh Ok 👌🏾 👍🏼 kool 😎. Thanks! 🙏🏿 $\endgroup$ – A-Dubb Jan 2 at 2:06
4
$\begingroup$

The answer provided by @Benjoyo is not accurate. The CPU clock can be lower than the system clock, at least in microcontrollers.

As seen in this link, the PIC microcontrollers have the CPU clock, with a rate of $f_{cy}$ (also called instruction cycle frequency), and the system clock, with a rate of $f_{osc}$ (oscillator frequency).

Physically, what provides the clock "ticks" to the microcontroller is a crystal oscillator. The oscillator basically has a crystal (X1 in the figure below) that when energized vibrates at a constant frequency.

enter image description here

[image ref]

The name "oscillator frequency", suggests that $f_{osc}$ is the input frequency of the microcontroller, that comes from the crystal oscillator. However, $f_{osc}$ usually refers to a scaled version of the crystal oscillator frequency, with PLL. The actual crystal oscillator frequency can be named as XTFREQ.

Fosc is the clock eventually with PLL, so with an 8MHz crystal and 4xPLL you would have an Fosc of 32MHz.

[quote ref]

On the other hand, the CPU clock $f_{cy}$ is obtained by dividing $f_{osc}$ by 2 as seen in the image below (this depends on the microcontroller).

enter image description here

[image ref]

So a more precise statement would be that the "CPU clock can be much higher than the input crystal oscillator clock (XTFREQ)". Also, depending on the system the CPU clock can actually be lower than the system clock (as mentioned above) or higher [ref].

| cite | improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ True, a good practical example of why it's useful on a microcontroller is to have high speed PWM and other counter operations while running the CPU at a comparatively lower speed to save power. $\endgroup$ – PeterJ Jan 1 at 1:13
  • 1
    $\begingroup$ Adding this to my online .pdf collection for engineering 📖 👩🏻‍💻 👨🏻‍💻 . Kool!! $\endgroup$ – A-Dubb Jan 2 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.