3.1 Hardware

The CPU and Architecture

1. The Evolution of Computing

Before the mid-1940s, computers were fixed-program machines. If you wanted a computer to switch from doing math to processing text, you had to physically rewire it.

The Challenge: Early computers like ENIAC required engineers to manually flip switches and move patch cables to "program" the machine. This took days or weeks for a single task. There was no "software" as we know it today.

2. The Stored Program Concept

In 1945, mathematician John von Neumann proposed a revolutionary idea: the Stored Program Concept.

The Core Idea

Both Data and the Instructions (the program) are stored together in the same Memory Unit (RAM).

This allowed a computer to be reprogrammed simply by loading a different set of instructions into memory, rather than changing the hardware.

3. Main Components of the CPU

The Von Neumann architecture defines three main components that work together to process data:

Control Unit (CU)

The "Manager" of the CPU. It directs the flow of data between the CPU and other devices. It manages the execution of instructions by sending control signals to the other components.

Arithmetic Logic Unit (ALU)

The "Calculator." It performs all Arithmetic calculations (addition, subtraction, etc.) and Logical operations (comparing values using AND, OR, NOT).

Memory Unit (Main Memory)

This refers specifically to Registers. They hold addresses (of data in RAM) as well as data and instructions fetched from RAM. The CPU can read from and write to this unit very quickly.

4. Why the Von Neumann Architecture?

  • Flexibility: The same hardware can perform any task as long as the instructions are provided in memory.
  • Efficiency: It uses a single set of buses to access memory, simplifying the design of the computer.
  • Universal Design: Almost every modern computer, from your smartphone to your laptop, is based on this foundational model.
⚠️ Exam Alert: You must remember that in a Von Neumann machine, instructions and data share the same memory and the same buses. This is often a 1-mark question!

Registers and the FDE Cycle

1. CPU Registers

Registers are high-speed storage locations inside the CPU. They hold data that is being processed immediately.

Program Counter (PC)

Holds the address of the next instruction to be fetched.

Memory Address Register (MAR)

Holds the address of the current instruction or data being read from/written to memory.

Memory Data Register (MDR)

Holds the actual data or instruction fetched from memory (or waiting to be written).

Current Instruction Register (CIR)

Holds the instruction that is currently being decoded and executed.

Accumulator (ACC)

Holds the results of calculations performed by the ALU.

2. System Buses

Buses are the physical connections (wires) that move data between the CPU and Memory.

  • Address Bus: Carries addresses from CPU to Memory. (One-way / Simplex).
  • Data Bus: Carries actual data/instructions between CPU and Memory. (Two-way / Duplex).
  • Control Bus: Carries signals (e.g., Read/Write) from the Control Unit. (Two-way).

3. The Fetch-Decode-Execute (FDE) Cycle

This is the continuous process the CPU performs to run programs.

Step 1: Fetch
  • The PC contains the address of the next instruction.
  • This address is copied to the MAR via the Address Bus.
  • The instruction at that address is moved to the MDR via the Data Bus.
  • The PC is incremented by 1 (pointing to the next instruction).
  • The instruction is copied from the MDR to the CIR.
Step 2: Decode

The Control Unit (CU) decodes the instruction in the CIR to see what needs to be done (e.g., is it an ADD, a STORE, or a LOAD?).

Step 3: Execute

The CPU carries out the instruction. If a calculation is needed, the ALU handles it and stores the result in the Accumulator (ACC).

⚠️ Exam Warning: A common mistake is saying the "Data Bus carries addresses." Remember: Addresses go on the Address Bus; Data goes on the Data Bus. Only the Address Bus is strictly unidirectional (CPU → Memory).

Buses

1. Overview of System Buses

A Bus is a set of parallel wires connecting two or more components of a computer. In the Von Neumann architecture, the CPU uses three specific buses to communicate with Main Memory (RAM).

Address Bus Unidirectional

Carries the address (location) of where data needs to be found or stored in memory.

Flow: CPU → Memory / I/O

Data Bus Bi-directional

Carries the actual data or instructions between the CPU and other components.

Flow: CPU ↔ Memory / I/O

Control Bus Bi-directional

Carries control signals (commands) from the Control Unit (CU) to coordinate all activities.

Flow: CPU ↔ All Components

2. Key Operations & Bus Width

The "width" of a bus refers to the number of parallel wires it has. This is a common exam point:

  • Address Bus Width: Determines the maximum memory capacity the CPU can address. For example, a 32-bit address bus can access $2^{32}$ addresses (4 GiB).
  • Data Bus Width: Determines how much data can be moved at once. A 64-bit data bus is faster than a 32-bit one because it can move twice as much data per clock cycle.

3. The Control Bus Signals

The Control Bus isn't just one signal; it carries many different "commands" to prevent data collisions. Common signals include:

  • Memory Read: Fetch from RAM.
  • Memory Write: Save to RAM.
  • Bus Request: Device wants to use a bus.
  • Bus Grant: CPU allows bus use.
  • Clock Signal: Synchronizes operations.
  • Interrupt Request: Device needs attention.

4. Exam-Style "How it Works"

If the CPU needs to Read data from memory:

  1. The CPU places the memory address on the Address Bus.
  2. The CPU sends a "Read" signal via the Control Bus.
  3. The Memory Unit locates the data and sends it back via the Data Bus.
⚠️ Critical Fact: The Address Bus is the ONLY one that is strictly Unidirectional. It only goes from the CPU to Memory. The CPU tells Memory where to look; Memory never tells the CPU where to look!

Cores, Cache and Clock Speed

1. CPU Cores

A Core is a complete copy of a CPU. A "Dual-core" processor has two CPUs, while a "Quad-core" has four.

Impact of Multiple Cores

Allows Parallel Processing. The computer can execute multiple instructions at the exact same time.

  • Pro: Better multitasking (e.g., gaming while streaming).
  • Con: Some software is not designed to use multiple cores, so it won't run any faster.

2. Clock Speed

The Clock Speed is the number of FDE cycles a CPU can perform per second. It is measured in Hertz (Hz).

The "Heartbeat"

Most modern CPUs run at 3 GHz to 5 GHz. A 3 GHz CPU performs 3 billion cycles every second.

  • Impact: Higher clock speed = instructions are executed faster.
  • Limit: High clock speeds generate heat, which can damage the CPU if not cooled.

3. The Cache Memory

Cache is a tiny amount of high-speed memory located inside the CPU chip. It stores frequently used data so the CPU doesn't have to wait for the slower RAM.

Typical Sizes: Usually measured in KB or MB (e.g., 8 MB L3 Cache). While small, it is thousands of times faster than RAM.
Use: It holds the "loops" and "most used variables" of a running program.

4. The Memory Hierarchy: Distinguishing the Three

It is vital to distinguish between these three storage areas for the exam:

Feature Registers Cache RAM (Main Memory)
Location Inside the ALU/CU Inside the CPU chip On the Motherboard
Size Few bytes (e.g., 64-bit) 2 MB – 32 MB 8 GB – 32 GB+
Speed Fastest Extremely Fast Fast (but slow for CPU)
Purpose Current instruction data Frequently used data Programs currently open

5. Summary: Performance Bottlenecks

Think of it like a kitchen:

  • Cores are the number of Chefs working.
  • Clock Speed is how Fast the chefs move.
  • Cache is the Countertop (right in front of the chef).
  • RAM is the Pantry (requires walking across the kitchen).
⚠️ Exam Note: Doubling the number of cores does not always double the speed. If the software is "single-threaded," only one core will do the work while the others sit idle!

Network Hardware

1. Network Interface & Connection Devices

NIC
Network Interface Card (NIC)

An internal hardware component that allows a computer to connect to a network. It contains the MAC Address, which is a unique physical identifier for the device.

Hub and Switch
Hub vs. Switch

Hub: Sends data packets to every device on the network. This is inefficient and causes security risks.

Switch: Smarter than a hub. It checks the destination MAC address and sends data only to the specific device intended, reducing network traffic.

Router
Router

The "Traffic Controller." It connects different networks together (e.g., your home LAN to the Internet). It uses IP Addresses to route packets across the most efficient path.

Modem
Modem (Modulator-Demodulator)

Converts Digital signals from a computer into Analogue signals for transmission over telephone lines/cables, and vice versa.

Bridge and WAP
Bridge & Wireless Access Point (WAP)

Bridge: Connects two separate LANs that use the same protocol so they function as a single network.

WAP: Provides a wireless signal (Wi-Fi) so mobile devices can join a wired network.

2. Advanced Networking & Security

Gateway
Gateway

A "node" that connects two networks that use different protocols. It translates the data so it can be understood by the receiving network.

Firewall
Firewall

A security system (can be hardware or software) that monitors incoming and outgoing traffic. It blocks unauthorized access based on a set of security rules.

Proxy Server
Proxy Server

Acts as an intermediary between a user and the internet. It can cache frequently visited pages to speed up access and hide the user's real IP address for privacy/security.

3. Connection Media

Networking hardware is linked together using various media:

  • Ethernet (Copper) Cable: Uses electrical pulses. Good for LANs but limited to 100m.
  • Fiber Optic Cable: Uses pulses of light. High bandwidth and long distance (backbones).
  • Radio Waves: Used by Wi-Fi and Bluetooth for wireless unguided transmission.