Quick Overview
This chapter covers the five main hardware systems inside a computer:
- CPU (Central Processing Unit) – The brain. It fetches instructions, decodes them, and executes them billions of times per second.
- Internal Memory – Two types: RAM (fast, temporary) and ROM (permanent, holds boot instructions).
- Input Devices – Let users send data into the computer (keyboard, mouse, scanner, sensors, etc.).
- Output Devices – Let the computer show results to the user (monitor, printer, speaker, etc.).
- Storage – Non-volatile secondary storage for long-term data (hard drives, SSDs, optical disks).
The CPU: The Brain of the Computer
What Does the CPU Do?
The CPU has one main job: fetch, decode, and execute instructions. Think of it like a chef reading a recipe (fetch the instruction), understanding what ingredients are needed (decode), then cooking (execute).
Analogy: Your brain takes in sensory information (fetch), understands what's happening (decode), and then decides what to do — move your arm, speak, think — and does it (execute). The CPU does the same thing with computer instructions, but billions of times per second.
The Fetch-Execute Cycle
The CPU runs the same cycle over and over, billions of times every second. This is what makes your computer "work."
The Three Stages of the Fetch-Execute Cycle:
- FETCH: The CPU gets the next instruction from RAM (main memory)
- DECODE: The CPU figures out what the instruction means and what it needs to do
- EXECUTE: The CPU carries out the instruction (do a calculation, store data, etc.)
⭐ Why Not Fetch from Storage?
RAM is much faster than your hard drive or SSD. If the CPU had to reach out to storage every time it needed an instruction, your computer would be incredibly slow. That's why data and programs must be copied from storage into RAM first — it's where the CPU can access things quickly.
The Four Key Components Inside the CPU
The CPU itself is made of smaller parts that work together:
1. Arithmetic Logic Unit (ALU)
Does all the math and logical decisions. It performs addition, subtraction, multiplication, division, and boolean logic (AND, OR, NOT). If the computer needs to calculate something, the ALU does it.
2. Control Unit (CU)
Acts like the CPU's manager. It controls the flow of data inside the CPU, tells the ALU what to do, and coordinates the whole fetch-execute-decode process.
3. Cache
Super-fast, tiny memory built right into the CPU. It's faster than RAM but much smaller. The CPU stores the most frequently used instructions and data here so it doesn't have to keep going back to RAM.
4. Registers
Incredibly fast, tiny storage locations inside the CPU where it holds data it's currently working with. Think of them as the CPU's notepad — it jots down what it's doing right now.
Memory Speed Hierarchy (Fastest to Slowest):
Registers → Cache → RAM → Storage (HDD/SSD)
Worked Example: The Input-Process-Output Model
Example: Playing a Video Game
Question: Describe the input, process, and output when you click a button on a game controller.
Internal Memory: RAM vs ROM
Input Devices: Getting Data In
Input devices let users send data or commands into the computer. The computer processes that input and produces output.