What is CPU
Part of the Fundamentals section of Coddy's Assembly journey. Lesson 1 of 45.
The CPU (Central Processing Unit) is the brain of the computer. But unlike a human brain, it is actually very simple. It does only one thing: it reads instructions from memory and executes them, one by one, very fast. When you write Assembly code, you're giving direct instructions to the CPU.
Unlike high-level languages like Python or JavaScript that hide hardware details, Assembly language allows you to control exactly what the CPU does, step by step.
Think of the CPU as a very fast worker who:
- Cannot think or make decisions on its own
- Follows simple commands like "add these two numbers" or "move this value there"
- Does millions of these simple commands every second
Inside the CPU there are tiny storage boxes called registers. A register holds a single number. The CPU can access registers extremely fast, much faster than accessing main memory (RAM).
The CPU also has a special register called the Program Counter (PC). The PC holds the memory address of the next instruction to execute. After each instruction, the PC automatically moves to the next address.
Key facts about a CPU:
| Fact | Explanation |
|---|---|
| It runs instructions one after another | Each instruction sees the result of the one before it. A modern CPU has several cores, so it can run several programs at the same time |
| It only understands numbers | Everything (instructions, data, addresses) is a number |
| It holds very little data itself | Registers hold the values it is working on, and a cache keeps copies of recently used data from RAM. The rest of a program's data is stored in RAM |
| It is incredibly fast | Modern CPUs execute billions of instructions per second |
Try it yourself
This lesson doesn't include a code challenge.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1The Machine
What is CPUMemoryRegisters vs MemoryHow instructions workTwo-File PatternThe x86-64 ArchitecturePractice on your own: Assembly playground