Hardware, Software, and the Four-Layer Model
A computer system relies on both physical equipment and intangible instructions to operate.
Hardware and Software
- Hardware refers to the physical parts of a computer system that you can touch. Examples include the CPU, RAM, hard disk drives, solid-state drives, keyboards, and monitors.
- Software refers to the programs, applications, and instructions that tell the hardware what to do. Software cannot be physically touched.
- System software manages and runs the computer hardware itself. Examples include operating systems such as Windows, macOS, and Linux, as well as utility programs and device drivers.
- Application software allows the end user to perform specific productive or recreational tasks. Examples include web browsers, word processors, and games.
The Four-Layer Computing Model
Computer systems use layered abstraction so users and software can interact with hardware without needing to manipulate physical circuitry directly:
- User: Interacts with software using graphical user interfaces (GUIs), touchscreen displays, or command-line interfaces.
- Application Layer: Software programs running tasks on behalf of the user.
- Operating System Layer: System software that manages system resources, handles input/output hardware, and provides a platform for applications.
- Hardware Layer: Physical electronic devices—CPU, memory, storage, and peripheral controllers.
Core Roles of the Operating System
- Processor Management: Allocates CPU time among running processes using scheduling algorithms and handles interrupts to maintain smooth multitasking.
- Memory Management: Allocates memory addresses to open programs so they do not overwrite each other's data, and uses virtual memory on secondary storage when RAM becomes full.
- File System Management: Organises data into hierarchical folders and files, keeps track of storage locations, and manages access permissions.
- Device Management: Uses device drivers to translate high-level operating system commands into specific hardware signals for peripherals.
- Security and User Authentication: Controls access to the computer using user accounts, passwords, and file permission settings.
The von Neumann Architecture and the Fetch-Decode-Execute Cycle
Most general-purpose computers follow the von Neumann architecture. Its key principle is that program instructions and data share the same main memory and communication buses, rather than being kept in separate storage units.
The Central Processing Unit (CPU) fetches, decodes, and executes instructions. It contains three primary components:
- Control Unit (CU): Manages the execution of instructions. It directs the flow of data within the CPU, coordinates hardware signals, and decodes instruction opcodes.
- Arithmetic Logic Unit (ALU): Carries out arithmetic calculations (such as addition and subtraction) and logical evaluations (
AND,OR,NOT, and comparisons like<,>). - Registers: Very fast, very small storage locations inside the CPU itself. Key registers include:
- Program Counter (PC): Holds the memory address of the next instruction waiting to be fetched.
- Memory Address Register (MAR): Holds the physical memory address currently being read from or written to.
- Memory Data Register (MDR): Holds the data value or instruction just fetched from memory, or waiting to be written to memory.
- Instruction Register (IR): Holds the instruction currently being decoded by the CU.
- Accumulator (ACC): Holds intermediate calculation results produced by the ALU.
The Fetch-Decode-Execute (FDE) Cycle
The CPU runs instructions in a continuous cycle:
- Fetch: The memory address in the PC is copied into the MAR. The CU sends a read signal to RAM along the control bus. The instruction at that memory address is returned via the data bus into the MDR, and then copied into the IR. The PC increments immediately to hold the address of the next instruction in sequence.
- Decode: The CU decodes the opcode in the IR to determine what operation must occur and what data operands are needed.
- Execute: The CU directs the necessary components to complete the task. If mathematical or logical operations are required, the ALU processes them and stores the result in the Accumulator. If data must be saved to RAM, it is sent via the MDR.
Tracing the FDE Cycle with a Simple Program
Consider a program with instructions at three sequential memory addresses: address 0 holds LOAD 5, address 1 holds ADD 6, and address 2 holds STORE 7. In RAM, memory address 5 contains the value 12, and address 6 contains the value 30.
| Cycle Step | PC | MAR | MDR | IR | ACC | Explanation |
|---|---|---|---|---|---|---|
| Start | 0 | - | - | - | 0 | CPU begins at instruction address 0. |
| Fetch 1 | 1 | 0 | LOAD 5 | LOAD 5 | 0 | Address 0 is fetched; PC increments to 1. |
| Execute 1 | 1 | 5 | 12 | LOAD 5 | 12 | Contents of address 5 (12) are loaded into ACC. |
| Fetch 2 | 2 | 1 | ADD 6 | ADD 6 | 12 | Address 1 is fetched; PC increments to 2. |
| Execute 2 | 2 | 6 | 30 | ADD 6 | 42 | ALU adds contents of address 6 (30) to ACC (12 + 30 = 42). |
| Fetch 3 | 3 | 2 | STORE 7 | STORE 7 | 42 | Address 2 is fetched; PC increments to 3. |
| Execute 3 | 3 | 7 | 42 | STORE 7 | 42 | ACC value (42) is written to memory address 7 via the MDR. |
Processor Performance and Memory Hierarchy
Factors Influencing Processor Performance
- Clock Speed: The number of electrical pulses the CPU clock generates per second, measured in hertz (Hz). A 3 GHz processor completes three billion clock cycles each second. A higher clock speed allows more instructions to be executed per second, provided the CPU is not stalled waiting for memory.
- Cache: A small bank of high-speed memory located directly on or beside the CPU core that stores frequently accessed instructions and data. A larger cache means the CPU finds more of its required data close by, reducing time spent waiting for slower RAM.
- Number of Cores: A core is an independent processing unit containing its own CU, ALU, and registers. Multiple cores allow parallel processing of separate instruction streams, but overall performance doubles only if software is specifically written to divide its workload across multiple threads.
Memory and Storage Hierarchy
Computer memory balances access speed, capacity, and cost per unit.
| Level | Volatility | Location | Speed | Purpose |
|---|---|---|---|---|
| Registers | Volatile | Inside the CPU | Fastest | Holds immediate operands, addresses, and calculation values |
| Cache | Volatile | Next to the CPU core | Very fast | Holds frequently repeated loop instructions and active data |
| RAM | Volatile | Main system board | Fast | Holds operating system files and active programs currently running |
| ROM | Non-volatile | System board chip | Moderate | Holds permanent startup instructions (BIOS/UEFI bootstrap loader) |
| Secondary Storage | Non-volatile | Drive bay / internal bus | Slower | Provides long-term persistent storage for files, applications, and the OS |
Primary Memory: RAM vs ROM
- Random Access Memory (RAM): The computer's main working memory. The CPU can read from and write to any location directly in any order. It is volatile, meaning all stored data is erased when power is lost.
- Read-Only Memory (ROM): Memory that can be read by the CPU but cannot be altered during standard operation. It is non-volatile, retaining its contents permanently without electrical power. It stores the bootstrap loader used to start the computer.
Secondary Storage: SSD vs HDD
Because RAM loses its data on shutdown, non-volatile secondary storage is required for long-term file retention:
- Solid-State Drives (SSDs): Store data electronically using flash memory chips with no moving parts. They offer faster read/write speeds, lower power consumption, and greater resistance to physical shocks.
- Hard Disk Drives (HDDs): Store data magnetically on rotating platters read by moving mechanical heads. They offer a lower cost per gigabyte for high capacities but operate much more slowly and are sensitive to physical impacts.
Networks, the Internet, and Communication Protocols
The Internet vs The World Wide Web
These terms refer to distinct layers of computer networking:
- The Internet: The global physical infrastructure of interconnected networks, transmission cables (undersea fibre-optic cables, copper lines), routers, switches, servers, and user devices that transports raw data packets worldwide.
- The World Wide Web (WWW): A distributed information service running on top of the Internet infrastructure. It consists of hyperlinked multimedia documents and web applications accessed via a web browser using HTTP.
Key Network Hardware Components
- Server: A high-capacity computer that stores network resources (web pages, files, databases) and serves them to requesting clients.
- Client: A user device (such as a laptop or smartphone) that requests services or content from a server.
- Router: A networking device that inspects the destination IP address on incoming data packets and directs them across different networks towards their destination.
- Switch: A device that connects computers together within a single local area network (LAN), directing frames directly to the intended destination device using MAC addresses.
- Network Interface Card (NIC): Hardware inside a computer that allows it to transmit and receive data over a physical cable or wireless (Wi-Fi) signal.
The TCP/IP Protocol Model
Network communication is organised into four hierarchical layers. Data passes down these layers on the sending device and back up through them on the receiving device:
- Application Layer: Interacts directly with software applications. Protocols like HTTP create requests for web documents, while VoIP handles audio and video streaming data.
- Transport Layer (TCP): Manages end-to-end communication reliability. TCP divides outgoing data into numbered packets, checks packet integrity, requests retransmission of lost packets, and reassembles them in order on the receiving computer.
- Internet Layer (IP): Handles packet addressing and routing across networks. IP adds the sender's and receiver's source and destination IP addresses to each packet header so routers can navigate them across different networks.
- Link Layer (Network Access): Converts packets into physical electrical, optical, or radio signals and transmits them over the local physical medium (Ethernet cable, Wi-Fi, or fibre).
Tracing a Client-Server Request
- A user enters a web address into a browser on the client computer.
- The browser generates an HTTP request at the Application layer.
- TCP at the Transport layer splits the request into numbered packets.
- IP at the Internet layer attaches source and destination IP addresses to each packet.
- The Link layer transmits the electrical or radio signals onto the local connection.
- Routers inspect each packet's destination IP address and route it across the Internet to the target server.
- The web server processes the request and sends the webpage back as an HTTP response in packets.
- TCP on the client machine confirms all packets arrived, reassembles them in order, and the browser renders the webpage.
Internet Protocols: HTTP, TCP, IP, and VoIP
- HTTP (Hypertext Transfer Protocol): An application layer protocol used by web browsers to request and receive web pages. HTTPS adds encryption, ensuring that intercepted packets cannot be read or altered.
- TCP (Transmission Control Protocol): Guarantees reliable, ordered delivery of data by requiring acknowledgements and retransmitting lost packets.
- IP (Internet Protocol): Directs packets across network boundaries using numerical IP addresses.
- VoIP (Voice over Internet Protocol): Transmits digitised voice calls over IP networks. Unlike TCP-based file transfers, VoIP prioritises real-time speed over absolute delivery perfection; dropped packets are skipped rather than retransmitted to prevent audible audio lag.
