Search
Course outline
  1. 01How a computer works
    1. 1.1What is a computer?(completed)
    2. 1.2The CPU: the brain(completed)
    3. 1.3Memory: RAM vs storage(completed)
    4. 1.4How the CPU and memory work together(completed)
    5. 1.5What happens when you turn on a computer(completed)
  2. 02How the Internet works
    1. 2.1What is the Internet?(completed)
    2. 2.2Addresses and names: IP and DNS(completed)
    3. 2.3Packets: how information travels(completed)
    4. 2.4Client and server: opening a website(completed)
    5. 2.5Inside a busy server(completed)
    6. 2.6Why this matters for AI(completed)
  3. 03Introducing the GPU
    1. 3.1What is a GPU?(completed)
    2. 3.2CPU vs GPU(completed)
    3. 3.3The GPU's own memory: VRAM(completed)
    4. 3.4How the CPU and GPU work together(completed)
    5. 3.5Why GPUs suit AI(completed)
  4. 04Tensors and models
    1. 4.1What is a tensor?soon
    2. 4.2What is an AI model?soon
    3. 4.3Training vs inferencesoon
  5. 05Splitting work across GPUs
    1. 5.1Why split work across GPUs?soon
    2. 5.2Data parallelismsoon
    3. 5.3Tensor parallelismsoon
    4. 5.4Pipeline parallelismsoon
    5. 5.5Expert parallelismsoon
    6. 5.6Which to use whensoon
  6. 06Serving LLMs with vLLM
    1. 6.1What is LLM serving?soon
    2. 6.2Meet vLLMsoon
    3. 6.3Serving a model with vLLMsoon

Lesson 1.2

The CPU: the brain

Meet the part that follows instructions, one tiny step at a time, very fast.

beginner 3 min readChecked

In one line

The CPU is the chip that runs a computer’s instructions, one tiny step at a time, billions of times every second.

Real-life analogy

The CPU is the chef in our restaurant.

The chef reads the recipe one line at a time: “chop the onion”, “heat the pan”, “add the onion”. Each line is simple. The magic is that the chef is incredibly fast and never skips a step.

A big kitchen can have several chefs working side by side. A CPU can have several cores, and each core is like one chef.

Where the comparison stops working: a real chef understands what a meal is supposed to taste like. A CPU understands nothing. It does not know it is running a game or a spreadsheet. It just follows the next instruction, exactly as written.

Diagram

INSTRUCTIONS (THE RECIPE)add 2 + 3compare: is it 5?if yes, jump aheadsave the resultTHE CPU (THE CHEF)Core 1Core 2Core 3Core 4Clock: tick, tick, tick...EACH CORE REPEATS, BILLIONS OF TIMES A SECOND:FetchDecodeExecuteStorenext instruction
A CPU takes simple instructions one by one. Each core repeats fetch, decode, execute, store, kept in step by a clock.

Step by step

In the last lesson we said the CPU does the “processing”. But what does processing actually look like inside the chip?

Instructions: tiny, exact steps

A CPU can only do very simple things. For example:

  • add two numbers,
  • compare two numbers,
  • jump to a different place in the list of instructions,
  • copy a number from one place to another.

That is roughly it. Everything you do on a computer, from a video call to a video game, is built from huge numbers of these tiny steps.

The cycle: fetch, decode, execute, store

How does the CPU work through a list of instructions? It repeats the same four moves:

  1. Fetch: get the next instruction from memory.
  2. Decode: work out what that instruction is asking for.
  3. Execute: do it, for example add the two numbers.
  4. Store: save the result, ready for the next step.

Then it goes back to step 1 for the next instruction. Again and again and again.

Cores: more than one chef

Older computers had a CPU with just one core. Most CPUs today have several cores on one chip.

Each core can follow its own list of instructions. So while one core is playing your music, another can be loading a web page. More cores means more work can happen at the same time.

Clock speed: how fast the chef works

Inside the CPU is a clock. It is not a clock that tells the time. It is a steady “tick, tick, tick” that keeps every part of the chip in step.

Clock speed is measured in gigahertz (GHz). One gigahertz means about one billion ticks every second. So a 3 GHz CPU ticks about 3 billion times a second.

Does a faster clock always mean a faster computer? Not always. Some instructions finish in one tick and others need several, and CPUs from different makers and years do different amounts of work per tick. That is why clock speed is best compared between similar CPUs.

Key takeaways

  • The CPU runs instructions: tiny, exact steps like “add” or “compare”.
  • Each core repeats fetch, decode, execute, store for every instruction.
  • Cores are like extra chefs: more cores, more work at the same time.
  • Clock speed (GHz) is how many billions of ticks per second, but it is not the whole story.

Recap: the CPU is a very fast, very literal chef. It follows the recipe one line at a time, billions of lines every second, and several chefs can work side by side.

Now you understand what a CPU does and what “cores” and “GHz” mean. Next, we will look at where the chef keeps the ingredients: memory and storage.

Quick check

Pick an answer, then press Check answer. Nothing is recorded.

  1. What does a CPU core do over and over?
  2. A CPU has 8 cores. What does that mean in plain words?
  3. A clock speed of 3 GHz means...

Sources

This lesson was checked against these pages.

  1. What is a Central Processing Unit? · Arm
  2. CPU Speed: What Is CPU Clock Speed? · Intel
  3. About Processes and Threads · Microsoft Learn