Byte by Byte › Book 6: Python, Data and How Computers Work › Chapter 1: How a Computer Really Works
Chapter 1: How a Computer Really Works
You will learn: the main parts inside a computer, what the CPU does in the fetch-decode-execute cycle, the difference between RAM, ROM, cache and storage, how storage is measured, and how to check your own computer's processor and memory.
🌟 The Adventure
The first lighthouse went dark on a Tuesday.
By Thursday, every lighthouse along the coast of Memunic World had stopped shining. Fishing boats bumped into rocks. The tide gates at Riverbend jammed half open. Even the golden Light Bridges flickered, because their cables ran under the sea.
On Friday evening Nimo appeared at Memoon's window in his water bubble, so upset that the bubble was wobbling. "It's the Deep Engine," he said. "It's failing. Octavia says it might stop completely. Memoon, I need you to come home with me."
Memoon had never heard of the Deep Engine. Nimo explained as they hurried to the shore. Long ago, the Old Makers had built a giant machine on the floor of the Data Sea. It ran the lighthouses, the tide gates and the undersea cables. Only one creature still knew how to look after it: Octavia, an ancient octopus who had been its Keeper for two hundred years.
At the water's edge, Nimo blew a glowing bubble that settled over Memoon's head like a clear helmet. She could breathe perfectly. Noodles, who had followed them, received one too, and looked betrayed. Then they dived.
The Data Sea glowed blue, criss-crossed with faint golden lines. Down and down they swam until a vast shape rose from the sea floor: a machine as big as a palace, made of stone and brass, its windows flickering weakly. A violet octopus with a brass headlamp floated at its door.
"So you are Memoon," said Octavia. Her voice was slow and kind. "Nimo says you understand machines. But do you know what a machine like this is actually made of?"
Memoon opened her mouth, and closed it again. She could use a computer. She could program one. But what was inside it? She had no idea.
"Then come in," said Octavia. "Let me show you."
💡 Learn With Memoon
Hardware and software. A computer system has two halves. Hardware is every part you can touch: the screen, the keyboard, the chips inside. Software is the instructions that tell the hardware what to do: programs, apps and the operating system. Hardware without software is a box that does nothing. Software without hardware has nowhere to run. You need both.
The big picture. In Book 1 you learned that a computer takes input, does processing, gives output, and can store things for later. Here is what really does each job:
| Job | Main parts that do it | Examples |
|---|---|---|
| Input | Input devices | Keyboard, mouse, touchscreen, microphone, camera, scanner, sensors |
| Processing | CPU (with help from RAM) | The processor chip |
| Output | Output devices | Monitor, speakers, printer, headphones, projector |
| Storage | Storage devices | SSD, hard disk drive, USB flash drive, memory card, cloud storage |
All these parts are connected to the motherboard, the large main circuit board inside the computer. It carries electrical signals between the parts along tiny copper tracks. The power supply turns electricity from the wall socket into the low voltages the parts need. In a laptop or phone, a battery does the same job when you are unplugged.
The CPU: the computer's processor. The CPU (central processing unit), or processor, is the chip that carries out the instructions in programs. It is often called the brain of the computer, but that is only partly true. A brain thinks for itself; a CPU only follows instructions, extremely fast. It has three important parts:
- The control unit (CU) reads each instruction, works out what it means, and directs the other parts.
- The arithmetic logic unit (ALU) does the actual calculations (adding, subtracting, comparing) and logic (true or false decisions).
- Registers are a few tiny, super-fast storage spaces right inside the CPU. They hold the instruction and the numbers being worked on right now.
The fetch-decode-execute cycle. Every program, from a calculator to a video game, is turned into a long list of very simple instructions such as load this number, add these two numbers, store the answer here. The CPU works through them one at a time, using the same three steps over and over:
- Fetch: the control unit gets the next instruction from memory.
- Decode: the control unit works out what the instruction means and what it needs.
- Execute: the instruction is carried out, often by the ALU, and the result is stored in a register or in memory.
Then it fetches the next instruction. This is the fetch-decode-execute cycle, also called the instruction cycle. A modern CPU repeats it billions of times every second.
Clock speed and cores. A CPU has a clock that ticks to keep every step in time. Clock speed is measured in hertz (Hz), meaning ticks per second. One gigahertz (GHz) is one billion ticks per second, so a 3 GHz processor ticks three billion times a second. Most modern CPUs also have several cores. Each core is a complete processor that can run its own cycle, so a quad-core CPU can work on four tasks at the same time. More GHz and more cores usually mean a faster computer, but only if the software is written to use them.
Memory and storage: not the same thing. People mix these words up all the time. They are different, and it matters.
| RAM | ROM | Storage (SSD or hard disk) |
|---|
| Full name | Random access memory | Read-only memory | Secondary storage |
| What it holds | Programs and data being used right now | The start-up instructions (firmware) | All your files, apps and the operating system |
| When power goes off | Everything is lost (volatile) | Kept (non-volatile) | Kept (non-volatile) |
| Can you change it? | Yes, constantly | Normally no (only special updates) | Yes |
| Speed | Very fast | Fast | Slower than RAM |
| Typical size today | 8 to 32 GB | A few MB | 256 GB to 2 TB |
A good way to picture it is a desk in a library. Storage is the library shelves: huge, and everything stays there. RAM is your desk: much smaller, but you can reach anything on it instantly. When you open a program, it is copied from storage onto the desk (RAM) so the
CPU can work with it quickly. When you switch off without saving, the desk is cleared, which is why unsaved work disappears. Your saved file is still safe on the shelf.
ROM and firmware. When you press the power button, RAM is empty, so how does the computer know what to do? The answer is in ROM, a chip on the motherboard holding firmware: built-in software that tests the hardware and starts loading the operating system. On modern PCs this firmware is called UEFI (older computers used a BIOS). This start-up process is called booting.
Cache: the CPU's pocket. Even RAM is slow compared with the CPU. So CPUs have cache memory: a small amount of very fast memory built into or beside the processor, holding the instructions and data used most often. When the CPU needs something, it checks registers first, then cache, then RAM, then storage. Each step is bigger but slower. This ladder is called the memory hierarchy.
Kinds of storage.
| Type | How it stores data | Good points | Weak points |
|---|---|---|---|
| Hard disk drive (HDD) | Magnetic spots on spinning metal platters, read by a moving arm | Cheap for large sizes | Slower; moving parts can break if dropped |
| Solid-state drive (SSD) | Flash memory chips, no moving parts | Very fast, silent, tough | Costs more per GB |
| USB flash drive, Flash memory memory card | Small, portable | Easy to lose; can wear out | |
| Optical disc (CD, DVD, Blu-ray) | Tiny pits read by a laser | Cheap to copy | Mostly old-fashioned now |
| Cloud storage (OneDrive, Google Drive) | On servers in data centres, reached over the internet | Access anywhere, safe from your device breaking | Needs internet; someone else holds your data |
Measuring storage. You met bytes, kilobytes, megabytes and gigabytes in Book 3. Here is the full ladder:
| Unit | Size | Roughly holds |
|---|---|---|
| Bit | A single 0 or 1 | One yes/no |
| Byte | 8 bits | One letter of English text |
| Kilobyte (KB) | About 1,000 bytes | A short paragraph |
| Megabyte (MB) | About 1,000 KB | A photo, or a minute of music |
| Gigabyte (GB) | About 1,000 MB | A film |
| Terabyte (TB) | About 1,000 GB | Hundreds of films |
Why "about"? Computers work in powers of 2, so they often count 1 KB as 1,024 bytes (2 to the power 10). Storage makers usually count 1 KB as exactly 1,000 bytes. That is why a new "512 GB" drive shows a little less in Windows. Both are measuring the same bytes; they just count them differently. You will see why 1,024 is special in Chapter 3.
Putting it together: what happens when you open a photo. You double-click the file (input). The operating system finds it on the SSD (storage) and copies it into RAM. The CPU fetches and executes millions of instructions to turn the file's data into coloured dots, using cache for speed. The result is sent to the graphics chip and appears on the monitor (output). All of this happens in under a second.
💡 Memoon’s tip: If your computer is slow when lots of programs are open, the desk (RAM) is probably full. Close what you are not using, and the computer will stop having to swap things back and forth with the shelves.

✍️ Try It Yourself
Activity 1: Meet your own computer's hardware.
- Click Start, then Settings (the gear icon).
- Click System, then scroll down and click About.
- Under Device specifications, find Processor and Installed RAM. Write them in your notebook. Is your processor's speed in GHz? How many GB of RAM do you have?
- Go back to System and click Storage. How big is your drive, and how much is used?
Activity 2: Watch the CPU and memory at work.
- Press Ctrl + Shift + Esc to open Task Manager. (If you see a small window, click More details.)
- Click Performance on the left (the icon looks like a small graph).
- Click CPU. Find the speed, the number of cores and the live graph. Note the percentage used.
- Open three or four apps (Paint, Edge, Calculator, Notepad). Watch the Memory graph. Does the amount used go up?
- Close the apps one by one. What happens to memory? Write what you saw.
- Click Disk 0. Does it say SSD or HDD?
Activity 3: Sort the parts. Copy this table into your notebook and tick the right column for each part: keyboard, CPU, monitor, SSD, microphone, printer, RAM, webcam, speakers, USB flash drive.
| Part | Input | Processing | Output | Storage |
|---|
Keyboard
Unplugged: Be the CPU. You need three people and some paper. One person is Memory, holding a numbered list of instructions on cards: 1. Write 5 in box A. 2. Write 3 in box B. 3. Add A and B, write the answer in box C. 4. Say box C aloud. 5. Stop. The second person is the Control Unit, who fetches one card at a time and reads it out. The third is the ALU, who does any calculation and writes in the boxes (the registers). Run the program. Then make up your own five-instruction program for another group to run. How many fetch-decode-execute cycles did it take?
🎉 Memoon Solves It
Octavia led them through the Engine. In the central chamber, the brass core pulsed slowly, far too slowly. Beside it stood a long stone table covered in glowing slates, so crowded that new slates were piled on the floor.
"Every time the Engine needs a tablet from the vaults, I copy it onto a slate on the worktable," said Octavia. "That is how it has always worked. But the table is full, and the Engine keeps sending me back to the vaults again and again."
Memoon looked at the table. Then at the vaults. Then at the slates on the floor. "The worktable is the Engine's RAM," she said slowly. "Fast memory for what it's using right now. But you never clear it. Half these slates are for lighthouses that switched off years ago."
Octavia's golden eyes widened. Together they cleared every slate that was no longer needed, carefully checking that each one was safely stored as a tablet in the vaults first.
With a free table, the core sped up. Its pulse quickened, brighter and brighter, and far above them, one by one, the lighthouses flickered back on.
But not all of them. And the tide gates were still stuck. Octavia frowned. "The Engine is faster. But it is still confused. The lighthouses, the gates and the cables are all shouting at the core at once, and nobody is telling them whose turn it is."
"Then the Engine needs someone in charge," said Memoon.
❓ Check Your Knowledge
- What is the difference between hardware and software? Give two examples of each.
- Name the three parts of a CPU and say what each one does.
- Put the steps of the instruction cycle in order: execute, fetch, decode.
- A CPU has a clock speed of 2.5 GHz. How many ticks is that per second?
- True or false: RAM keeps your data when the computer is switched off. Explain.
- What is stored in ROM, and why does a computer need it?
- Why do CPUs have cache memory?
- Give one advantage of an SSD over a hard disk drive, and one advantage of a hard disk drive over an SSD.
- Arrange from smallest to largest: GB, bit, TB, KB, byte, MB.
- Fill in the blank: when you open a program, it is copied from ________ into ________ so the CPU can use it quickly.
- Challenge: Your friend says, "My laptop has 512 GB of memory." What do they probably mean, and how would you correct them politely?
📚 Word Bank
- Hardware: the physical parts of a computer you can touch.
- Software: the programs and instructions that tell hardware what to do.
- Motherboard: the main circuit board that connects all the parts of a computer.
- CPU (processor): the chip that carries out program instructions.
- Control unit: the part of the CPU that fetches and decodes instructions and directs the other parts.
- ALU (arithmetic logic unit): the part of the CPU that does calculations and comparisons.
- Register: a tiny, very fast storage space inside the CPU.
- Fetch-decode-execute cycle: the three steps a CPU repeats to carry out each instruction.
- Clock speed: how many cycles a CPU's clock ticks per second, measured in GHz.
- Core: a complete processing unit inside a CPU; multi-core CPUs can run several tasks at once.
- RAM: fast, volatile memory holding the programs and data in use right now.
- ROM: non-volatile memory holding firmware that starts the computer.
- Volatile: loses its contents when the power is switched off.
- Firmware: software built into hardware, such as UEFI or BIOS.
- Booting: the process of starting a computer and loading the operating system.
- Cache: small, very fast memory near the CPU holding frequently used data.
- Memory hierarchy: the ladder of registers, cache, RAM and storage, from fastest and smallest to slowest and largest.
- SSD: a fast storage device that uses flash memory and has no moving parts.
- Terabyte (TB): about 1,000 gigabytes.
Keep learning with Byte by Byte
Explore Book 6: Python, Data and How Computers Work. Find the ebook, purchase details and teaching slides on MemuniCity.
Comments
Post a Comment