Rocket wants to know everything. "So the processor reads a step, the clock ticks and switches flip. But how does it all fit?"
Raven draws a box on the whiteboard with an arrow going in and out. "What do you notice?" she asks. "A step goes in. An answer comes out."
Nova lights up a path through the box. "Let me show you one tick," she says. "Would you like a hint? Fetch, do, next. Every single time."
Every instruction follows the same three moves inside the processor.
Fetch: the processor gets the next instruction from memory. Do: it carries out that one step. Next: it points at the following instruction.
Then the clock ticks and the three moves happen again. Fetch, do, next, tick. Fetch, do, next, tick.
The instructions and the numbers are all in binary. The processor is a huge pattern of switches that flips in time with the clock.
You can act out a processor on paper. Start with a number. Follow each instruction in order. Never skip one.
Here is a tiny program. Trace it one step at a time.
| Step | Instruction | Number after the step |
|---|---|---|
| 1 | Start with 2 | 2 |
| 2 | Add 3 | 5 |
| 3 | Double it | 10 |
| 4 | Take away 4 | 6 |
The processor does not know the answer early. It only knows the number after each step. That is exactly how it works inside a real machine.
| Statement | True or false? |
|---|---|
| The processor fetches instructions from memory. | ? |
| The processor can do a step before it fetches it. | ? |
| Order does not matter when tracing a program. | ? |
| Inside the processor, numbers are stored as bits. | ? |
One more idea. Many processors today have several cores. A core is a complete fetch, do, next machine.
A processor with four cores can follow four lists at once, one per core. It is like four cooks in one kitchen, each with a recipe.
Even so, each core still does one instruction at a time.
You traced a program like a real processor! Tomorrow you will review the week and run the Fix-It Bay for a day.