The Central Processing Unit (CPU)
Key Definition
The CPU (Central Processing Unit) is the brain of the computer that processes program instructions. It fetches instructions from memory, decodes them, and executes them using the fetch-decode-execute cycle.
Think of It Like This...
The CPU is like your brain - it's the "thinking" part of the computer!
- Your brain receives information (eyes, ears) → CPU fetches instructions
- Your brain understands what it means → CPU decodes instructions
- Your brain tells your body what to do → CPU executes instructions
Just like your brain does this constantly (breathe, blink, think), the CPU does this millions of times per second!
Von Neumann Architecture
Most modern computers are based on Von Neumann architecture, named after mathematician John Von Neumann who described it in 1945. It uses the stored program concept.
The Kitchen Analogy
Imagine the computer is a kitchen:
- RAM (Memory) = The countertop where you put ingredients AND recipes
- CPU = The chef who reads recipes and cooks
- Instructions = The recipe steps ("chop onions", "boil water")
- Data = The ingredients (onions, water, pasta)
Key insight: In Von Neumann architecture, recipes and ingredients sit on the SAME countertop (same memory) - the chef reads one instruction at a time and does it before reading the next!
The key elements of Von Neumann architecture are:
- Data and instructions are both stored as binary digits (1s and 0s)
- Data and instructions are stored together in the same RAM
- Instructions are fetched from memory one at a time and in order (serially)
- The processor decodes and executes an instruction before fetching the next one
- The cycle continues until no more instructions are available
Key Fact
The stored program concept means that both data and instructions are stored in main memory, allowing the same hardware to run different programs. Before this, computers were "hard-wired" to do only ONE task!
Von Neumann Architecture Diagram
(Control Unit + ALU + Registers)
(Data + Instructions)
(Keyboard, Screen, etc.)
All connected by buses (data highways)
CPU Components
The CPU consists of several key components that work together:
| Component | Purpose |
|---|---|
| Control Unit (CU) | Fetches, decodes and manages execution of instructions; controls hardware and data flow |
| Arithmetic Logic Unit (ALU) | Performs arithmetic calculations (add, subtract, multiply, divide) and logical decisions (comparisons) |
| Registers | Small amounts of high-speed memory within the CPU used for temporary storage during processing |
| Cache | Small, fast memory that stores frequently used data and instructions for quick access |
| Clock | Sends regular electrical pulses to synchronise all components; measured in Hertz (Hz) |
| Buses | High-speed internal connections that transfer data between components |
Key Registers
The CPU uses special registers during the fetch-decode-execute cycle. Think of registers as tiny sticky notes on the chef's hand - small, super fast storage for things being worked on RIGHT NOW.
The Post Office Analogy
Think of fetching instructions like collecting a parcel from the post office:
- PC = Your queue ticket number (tells you who's NEXT)
- MAR = The address label you show to the clerk (WHERE to find it)
- MDR = The actual parcel you receive (the DATA itself)
- CIR = The parcel you're currently opening (instruction being worked on)
- ACC = Your receipt showing the total (result of calculations)
| Register | Full Name | Purpose |
|---|---|---|
| PC | Program Counter | Holds the memory address of the NEXT instruction to be fetched |
| MAR | Memory Address Register | Holds the ADDRESS in memory that is about to be read from or written to |
| MDR | Memory Data Register | Holds the DATA that has been fetched from memory or is about to be written |
| CIR | Current Instruction Register | Holds the instruction CURRENTLY being decoded and executed |
| ACC | Accumulator | Holds the RESULTS of calculations performed by the ALU |
Memory Trick: "PC MARches to MDR, CIR ACCepts"
Program Counter → points to next instruction
Memory Address Register → holds the ADDRESS
Memory Data Register → holds the DATA
Current Instruction Register → holds CURRENT instruction
ACCumulator → holds ACCUMULATED results
Tip: MAR = Address (both have 'A'), MDR = Data (both have 'D')!
The Fetch-Decode-Execute Cycle
The CPU processes instructions using a continuous cycle that repeats billions of times per second!
The Fast Food Analogy
Think of the CPU like a fast food worker making orders:
- FETCH = Read the next order ticket from the pile
- DECODE = Understand what the order means ("Big Mac meal" = burger + fries + drink)
- EXECUTE = Actually make the food and hand it over
Then grab the NEXT ticket and repeat... forever! That's what the CPU does with instructions.
FETCH
Get the next instruction from memory
DECODE
Work out what the instruction means
EXECUTE
Carry out the instruction
The Detailed Steps (What the Registers Do)
FETCH - Step 1
The address in the PC is copied to the MAR. The PC is then incremented by 1 (ready for next instruction).
FETCH - Step 2
The processor sends the address along the address bus to fetch the instruction from RAM.
FETCH - Step 3
The instruction travels along the data bus to the MDR, then gets copied to the CIR.
DECODE
The Control Unit decodes the instruction in the CIR to work out what needs to be done.
EXECUTE
The instruction is carried out (e.g., the ALU does a calculation). Results are stored in the ACC. The cycle then repeats!
Exam Tip - Remember the Order!
The cycle is always Fetch → Decode → Execute (FDE). A common exam question asks you to describe what happens at each stage. Remember:
- Fetch involves: PC, MAR, MDR, CIR, address bus, data bus
- Decode involves: Control Unit, CIR
- Execute involves: ALU (for calculations), ACC (for results)
System Buses
Three types of bus connect the CPU to other components. Think of buses as highways inside your computer!
The Highway Analogy
Imagine your computer has three motorways connecting the CPU to memory:
- Address Bus = Signs saying WHERE to go (one-way, outbound only)
- Data Bus = Lorries carrying the actual goods (two-way traffic!)
- Control Bus = Traffic lights and signals (telling everyone what to do)
Address Bus
Carries memory addresses from CPU to RAM
Direction: ONE-WAY (CPU → Memory)
Think: "Go to locker number 42"
Data Bus
Carries the actual data between CPU and components
Direction: TWO-WAY (can read AND write)
Think: "Here's the actual stuff!"
Control Bus
Carries control signals (read/write, clock)
Direction: TWO-WAY
Think: "READ this!" or "WRITE this!"
Memory Trick for Buses
Address = Address (where to go) - ONE way
Data = Delivery (the actual stuff) - TWO ways
Control = Commands (read/write signals) - TWO ways
Factors Affecting CPU Performance
Clock Speed
Measured in GHz. Higher clock speed = more instructions per second. Modern CPUs run at 3-5 GHz.
Number of Cores
Each core can process instructions independently. Dual-core = 2 cores, Quad-core = 4 cores.
Cache Size
Larger cache = more frequently used data stored for fast access, reducing trips to slower RAM.
Craig 'n' Dave: The CPU
The CPU and Von Neumann Architecture explained
Past Paper Question
Q: Describe the purpose of the MAR and MDR in the fetch-decode-execute cycle. (4 marks)
Mark Scheme:
- MAR holds the address of the memory location to be read from/written to (1)
- MDR holds the data that has been fetched from memory (1)
- Or holds the data that is to be written to memory (1)
- MAR is connected to the address bus (1)
- MDR is connected to the data bus (1)
Memory
Key Definition
Memory (also called primary storage) is internal storage that holds data and programs needed by the CPU. Main memory provides fast access but is limited in size compared to secondary storage.
Think of Memory Like Your Desk
Imagine you're doing homework at your desk:
- RAM = Your desk surface (where you put books you're CURRENTLY using)
- ROM = Instructions printed on your desk (always there, can't change them)
- Secondary Storage = Your bookshelf (where books are stored when not in use)
When you turn off your computer, it's like clearing your desk - but your bookshelf (storage) keeps everything safe!
Types of Main Memory
Volatile vs Non-Volatile - What Does It Mean?
Volatile = "Forgetful"
Like a goldfish - forgets everything when the power goes off!
Non-Volatile = "Remembers"
Like an elephant - never forgets, even without power!
RAM (Random Access Memory)
Analogy: RAM is like a whiteboard - you can write on it, erase it, and write again. But when you go home (power off), the cleaners wipe it clean!
- Volatile - loses contents when power is off
- Read AND Write - can add and change data
- Stores currently running programs and data
- Fast access by the CPU
- Contents constantly changing
ROM (Read Only Memory)
Analogy: ROM is like a printed textbook - you can read it, but you can't change what's written. The information is permanent!
- Non-volatile - keeps contents when power is off
- Read ONLY - cannot be written to
- Stores the BIOS/bootstrap program
- Contents are fixed during manufacture
- Used to start up the computer
What is the BIOS?
The BIOS (Basic Input/Output System) is the first software that runs when you turn on your computer. It's stored in ROM and does a "health check" of all your hardware before loading the operating system. Without it, your computer wouldn't know how to start!
| Feature | RAM | ROM |
|---|---|---|
| Volatile? | Yes - loses data when power off | No - keeps data without power |
| Read/Write? | Both read AND write | Read ONLY |
| Contents | Constantly changing | Fixed/permanent |
| Purpose | Store running programs & data | Store startup instructions (BIOS) |
| Size | Larger (8GB - 64GB typical) | Smaller (few MB) |
Cache Memory
The Pocket Analogy
Imagine you're a student doing research:
- Your pocket = Cache (tiny, but you can grab things INSTANTLY)
- Your desk = RAM (bigger, quick to reach)
- The library = Hard Drive (huge capacity, but takes ages to walk there!)
You keep your most-used pen in your pocket so you don't have to reach to your desk every time. That's what cache does!
Cache is a small amount of very fast memory located inside the CPU:
- Much faster than RAM (because it's right next to the processor!)
- Stores frequently used instructions and data
- Reduces the number of times the CPU needs to access RAM
- Available in levels: L1 (fastest, smallest), L2, L3 (largest, slowest)
- More cache = better performance but higher cost
Cache Levels - Speed vs Size
L1
Fastest
~64KB
L2
Fast
~256KB
L3
Slower
~8MB
Smaller cache = Faster access | Larger cache = More storage
Why is Cache So Fast?
Cache is located inside the CPU chip itself, so data doesn't have to travel along the system buses. It's like having answers written on your hand during a test vs. looking them up in a textbook!
Virtual Memory
The Overflowing Desk Analogy
Imagine your desk (RAM) is full of books, but you need to open MORE books:
- You put some books you're NOT currently reading on the floor (hard drive)
- When you need them again, you swap them back to your desk
- This lets you work with MORE books than your desk can hold!
The problem? Constantly bending down to swap books is SLOW! That's why virtual memory is slower than real RAM.
When RAM is full, the operating system uses virtual memory:
- Part of the hard drive is used as temporary RAM
- Data not currently needed is swapped out to the hard drive
- Allows computers to run more programs than physical RAM would allow
- Much slower than actual RAM because hard drives are slower
- Excessive use causes "thrashing" - constant swapping that slows the computer
What is Thrashing?
If your computer spends more time swapping data in and out of virtual memory than actually doing work, it's called thrashing. Your computer becomes extremely slow! The solution? Add more RAM!
Craig 'n' Dave: RAM, ROM and Virtual Memory
Understanding different types of memory
Past Paper Question
Q: Explain why a computer with more RAM might run faster than one with less RAM. (3 marks)
Mark Scheme:
- More programs/data can be stored in RAM at once (1)
- Less need to use virtual memory/swap files (1)
- RAM is faster than the hard drive/secondary storage (1)
- So the CPU can access data more quickly (1)
Secondary Storage
Key Definition
Secondary Storage is non-volatile, long-term storage used to keep programs and data when the computer is switched off. Unlike main memory, data is retained without power.
Why Do We Need Secondary Storage?
Remember: RAM is like a whiteboard - it gets wiped when power is off! We need somewhere to save our work permanently.
Analogy: RAM = your short-term memory (forgets when you sleep). Secondary Storage = your photo album (keeps memories forever!)
Why is Secondary Storage Needed?
- RAM is volatile - loses contents when power is off
- RAM has limited capacity compared to storage needs
- Programs and data need to be stored permanently
- Data needs to be portable between devices
Types of Secondary Storage
Magnetic Storage (HDD)
Analogy: Like a record player - a spinning disk with a moving arm that reads/writes data!
How it works: Spinning metal platters coated in magnetic material. A read/write head moves across the surface.
Examples: Hard Disk Drives (HDD)
Solid State Storage (SSD)
Analogy: Like a USB flash drive but bigger - NO moving parts, just electronic chips!
How it works: Data stored as electrical charges in flash memory chips. No spinning or moving parts.
Examples: SSD, USB stick, SD card
Optical Storage
Analogy: Like reading Braille with a laser - the laser feels the bumps (pits) and flat areas (lands) on the disc!
How it works: Laser reads tiny pits and lands burned into the disc surface.
Examples: CD, DVD, Blu-ray
Cloud Storage
Analogy: Like a storage locker in another city - your stuff is there, but you need the internet to access it!
How it works: Data stored on remote servers owned by companies like Google, Microsoft, Apple.
Examples: Google Drive, iCloud, OneDrive
| Feature | Magnetic (HDD) | Solid State (SSD) | Optical |
|---|---|---|---|
| Speed | Medium | Fastest | Slowest |
| Capacity | Highest (up to 20TB) | High (up to 4TB) | Lowest (25GB max) |
| Cost per GB | Cheapest | Most expensive | Very cheap (bulk) |
| Durability | Fragile (moving parts) | Very durable | Scratches easily |
| Portability | Low (usually internal) | High (USB, SD) | High (discs) |
Optical Storage Capacity
CD
Capacity: ~700 MB
Uses infrared laser
DVD
Capacity: ~4.7 GB (single layer)
Uses red laser
Blu-ray
Capacity: ~25 GB (single layer)
Uses blue laser (shorter wavelength)
Choosing Storage
When choosing storage, consider:
- Capacity: How much data needs to be stored?
- Speed: How quickly does data need to be accessed?
- Portability: Does the storage need to be moved between devices?
- Durability: How robust does the storage need to be?
- Cost: What is the budget?
Embedded Systems
Embedded computers (like digital watches or washing machines) often don't need secondary storage. Their instructions are stored in ROM and any temporary data is held in RAM.
Craig 'n' Dave: Secondary Storage
Magnetic, optical and solid-state storage explained
Past Paper Question
Q: A photographer needs to choose between an SSD and an HDD for storing photos. Give two reasons why an SSD would be more suitable. (2 marks)
Mark Scheme:
- SSD is faster so photos load/save more quickly (1)
- SSD has no moving parts so is more durable/reliable (1)
- SSD is lighter/more portable (1)
- SSD uses less power (1)
Software
Key Definition
Software refers to programs, applications, and data stored in a computer system. It is everything that isn't physical hardware.
Types of Software
System Software
Software that manages the computer hardware and provides a platform for applications.
- Operating Systems (Windows, macOS, Linux)
- Utility Software
- Device Drivers
Application Software
Software designed for end-users to perform specific tasks.
- Word Processors
- Web Browsers
- Games
- Spreadsheets
Operating Systems
An operating system is essential for any general-purpose computer. It performs these key functions:
| Function | Description |
|---|---|
| User Interface | Provides a way for users to interact with the computer (GUI, command line) |
| File Management | Organises files in folders/directories, handles naming, copying, moving, deleting |
| Process Management | Controls which programs run, allocates CPU time using scheduling algorithms |
| Memory Management | Allocates RAM to programs, manages virtual memory when RAM is full |
| Hardware Management | Controls input/output devices using device drivers |
| Security | User accounts, passwords, access permissions |
Scheduling Algorithms
The OS uses scheduling algorithms to manage multiple processes:
- First Come First Served (FCFS): Processes run in the order they arrive. Simple but slow.
- Round Robin: Each process gets a fixed time slice, then moves to the back of the queue. Fairer and more responsive.
- Priority-Based: Processes are given priorities; higher priority processes run first.
Utility Software
Utility software helps maintain the system:
| Utility | Purpose |
|---|---|
| Disk Defragmentation | Reorganises fragmented files on HDD so they are stored contiguously, improving access speed |
| Backup Software | Creates copies of files to protect against data loss (full or incremental backups) |
| Anti-virus/Anti-malware | Scans for and removes malicious software |
| Compression | Reduces file sizes for storage or transmission |
| Encryption | Scrambles data to protect it from unauthorised access |
| File Manager | Create, rename, copy, move, delete files and folders |
Defragmentation
Defragmentation is only needed for HDDs (magnetic drives). SSDs don't benefit from defragmentation because they have no moving parts and access any location equally fast.
Backup Types
Full Backup
Copies ALL files. Takes longer and uses more storage, but easy to restore.
Incremental Backup
Only copies files changed since the last backup. Faster but needs full backup + all incrementals to restore.
Craig 'n' Dave: Purpose and Functionality of Operating Systems
What an operating system does and why we need one
Craig 'n' Dave: Utility Software
Backup, defragmentation, compression and more
Craig 'n' Dave: Operating Systems Part 1
Introduction to operating system concepts
Craig 'n' Dave: Operating Systems Part 2
More operating system features and management
Past Paper Question
Q: Explain why defragmentation would improve the performance of a hard disk drive. (3 marks)
Mark Scheme:
- Files become fragmented/split into parts stored in different locations on the disk (1)
- Defragmentation rearranges files so they are stored contiguously/in sequence (1)
- This reduces the time taken to read a file as the read/write head doesn't need to move as much (1)
Programming Languages
Key Definition
Programming Languages are used to write software. They are classified as high-level or low-level depending on how close they are to human language or machine code.
High-Level vs Low-Level Languages
High-Level Languages
- Use English-like statements (print, if, while)
- Easier to read, write, and debug
- Portable - work on different processors
- Must be translated to machine code
- Examples: Python, Java, C#, JavaScript
Low-Level Languages
- Close to machine code
- Harder to read and write
- Processor-specific (not portable)
- Direct hardware control
- Examples: Assembly language, Machine code
Types of Low-Level Language
- Machine Code: Binary instructions (0s and 1s) that the CPU can execute directly. Different for each processor type.
- Assembly Language: Uses mnemonics (e.g., ADD, MOV, JMP) instead of binary. Slightly easier to read than machine code. Must be translated by an assembler.
Translators
Programs written in high-level or assembly languages must be translated into machine code:
| Translator | Input | How it Works | Advantages | Disadvantages |
|---|---|---|---|---|
| Compiler | High-level source code | Translates the whole program at once into an executable file | Faster execution, code is hidden from users, can be distributed without translator | Slower to develop (must recompile after changes), harder to debug |
| Interpreter | High-level source code | Translates and executes one line at a time | Easier to debug (stops at error line), quicker to test changes | Slower execution, source code must be distributed, needs interpreter to run |
| Assembler | Assembly language | Translates assembly mnemonics into machine code (one-to-one) | Produces efficient machine code | Specific to one processor type |
Key Fact
Python is often interpreted during development for easy testing, but can be compiled for distribution. Java uses both - it compiles to bytecode which is then interpreted by the Java Virtual Machine (JVM).
When to Use Low-Level Languages
- Device drivers: Direct hardware control is needed
- Embedded systems: Limited memory and processing power
- Time-critical applications: Maximum performance required
- Operating system components: Need to interact with hardware
Craig 'n' Dave: Programming Language Levels
Characteristics and purpose of high-level and low-level languages
Craig 'n' Dave: Compilers and Interpreters
How different translators work
Past Paper Question
Q: Explain one advantage and one disadvantage of using an interpreter rather than a compiler. (4 marks)
Mark Scheme:
- Advantage: Easier to debug because errors are identified line by line (1) and the program stops at the exact line with the error (1)
- Disadvantage: Slower execution because the code is translated every time it runs (1) rather than being translated once like a compiled program (1)
Topic 3 Quiz
Test Your Knowledge
Complete this 15-question quiz to test your understanding of computers, CPU, memory, storage, and software. You'll receive a PDF certificate with your results that you can download or send to your teacher.