The clock, the beat everything moves to
The CPU, the memory, and every other part: how do they all move in perfect step? The secret is a single 'clock' inside the computer that never stops ticking.
Tick: one beat
It's not a clock with hands.
A clock is just a signal that flips between 0 and 1, very fast.
0, 1, 0, 1... each rise-and-fall is 'one beat',
and on every upbeat the computer takes one step.
One up-and-down of 0 and 1 is one beat. Each tick adds one step.
To our eyes it looks like blinking,
but a real computer ticks hundreds of millions of times per second.
That's why everything seems to happen 'all at once'.
Everyone steps together
Why bother with a beat at all?
There are many parts, and if each moved on its own,
they'd clash and tangle.
So they all follow the same beat,
stepping together exactly when it says 'now!'
Turn the beat off and the parts tangle. Turn it on and they move in line on 'now!'
Within one beat, every part
finishes its job and waits for the next.
The beat is like a whistle that says 'go, together!'
How many per second? Hertz
How many times the beat ticks per second,
we call that hertz (Hz).
1 Hz is once per second; 1 GHz is a billion times a second!
More ticks means more steps,
so the computer runs faster.
Slide from slow to fast. The steps-per-second number explodes.
So a number like '3.2 GHz'
is exactly that computer's beat speed:
3.2 billion ticks every second.
Everything runs on top of a beat
faster than we can imagine.
Faster isn't always better
So can we just keep cranking the beat up?
No. Two walls stop us.
One: if the next beat arrives before
a step has finished, it trips and falls.
Two: the faster it goes, the more heat
it makes and the more power it eats.
Keep pushing the beat up. Heat and power soar, and past the limit a step breaks down.
That's why modern computers,
instead of forever raising the beat,
went with many workers (cores) instead.
Speed has a real-world ceiling.
(We'll meet this again in a later area.)
Now, a beating heart
The CPU we built (lesson 12)
fetches one instruction per beat.
It pulls quickly from the cache (lesson 13),
and parts pass things along the bus (lesson 14).
The clock is the heart that makes it all beat.
On each beat the CPU fetches and runs one instruction. The computer's body finally starts to beat.
We started from 0 and 1, through gates and adders, the CPU, memory and the bus, and now the beat that drives them all. On this beat, 'if' and 'repeat' come to life. Next time we'll gather all of it into one.