seegongsik
Structure

What is a clock in a CPU

How do the CPU, memory, and all the other parts move in perfect step with each other? The secret is a single "clock" that ticks nonstop inside the computer.

01

Tick, one beat

This clock doesn't have hour and minute hands.
A clock is simply a signal that switches between 0 and 1 very fast.
0, 1, 0, 1... one rise and fall is one beat, and every time the signal rises, the computer takes one step.

0 / 1 : 0
0
steps

One rise and fall of 0 and 1 is one beat. Each tick adds one to the step count.

In the picture below it looks like blinking, but a real computer ticks billions of times every 1 second.
That's why, to our eyes, everything seems to happen at once.

02

Everyone steps together

Why bother with a beat at all?
With many parts, if each moved on its own schedule, they'd fall out of step and the work would get tangled.
So they all follow the same beat and move one step together at the moment of "now!"

CPU
Memory
I/O
No beat: they tangle

Turn the beat off and the parts tangle; turn it on and they move side by side on "now!"

Within one beat, every part finishes its job and waits for the next beat.
The beat is like a whistle that says "everyone, go!"

03

How many per second? Hertz

How many times the beat ticks in 1 second is measured in hertz (Hz).
1 Hz is once every 1 second; 1 GHz is a whopping billion times every 1 second.
The more it ticks, the more steps it takes, so the computer gets faster.

1 Hz
1
steps in 1 sec

Slide from slow to fast and the steps per 1 second explode.

So a number like "3.2 GHz" is that computer's beat speed.
It means 3.2 billion ticks per second.
Everything runs on a beat faster than we can imagine.

04

Faster isn't always possible

So why not raise the beat forever?
It doesn't work, because there are two walls.
First, if the next beat arrives before a step has finished, the steps fall apart. Second, the faster it goes, the more heat it gives off and the more electricity it uses.

Beat speed
Heat
Power
Steps stable

Keep raising the beat and heat and power shoot up; past the limit, the steps collapse.

So instead of simply raising the beat, today's computers went another way: more workers (cores).
There's a practical limit to speed.
You'll meet cores again in another section.

05

Now, a beating heart

The CPU we built (Lesson 12) fetches instructions one by one in time with this beat.
It pulls values quickly from the cache (Lesson 13), and parts pass values along the pathway (Lesson 14).
The clock is the heart that keeps all of it beating.

CPU
Fetch
Beat 0

On every beat, the CPU fetches and runs one instruction. The computer's body finally starts to beat.

Starting from 0 and 1, we've come through gates and adders, the CPU, memory, and the pathway, all the way to the beat that keeps them all moving. "If" and "repeat" run on this beat too. In the next lesson, we'll gather everything so far in one place.

In one lineThe clock is the computer's beat. With every tick, all the parts move forward one step together, and how many times it ticks in 1 second is its speed (Hz).
← Structure
Was this helpful? Support seegongsik