Stage 3 · Lesson 5 of 9
How a CPU runs a program
A , the chip that runs your code, repeats one cycle billions of times a second. It fetches the next instruction from memory, decodes it (works out what it means), executes it, and moves on. Instructions are tiny steps: load a value into a , add two registers, compare, jump to another address.
Registers are a handful of very fast storage slots inside the CPU. Main memory is much slower, so a , a small store of recently used data, sits close by. Every line you write becomes many of these machine code instructions.
This explains practical things later. Walking an array in order is faster than jumping around memory. And a million iterations are nothing for a CPU, while a million network calls take a very long time.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CourseFreeCS50: Introduction to Computer Science
Harvard University · Beginner
Weeks 0, 1, 2 and 4 teach C, arrays and memory; the difficulty is the point
- VideoFreeCrash Course Computer Science
CrashCourse · Beginner
Short free videos from logic gates to operating systems; episodes 1 to 20
Keep handy
Also worth your time
- What Happens WhenGo deeper
Everything from a key press to a rendered page; read it after this stage