Unit 1: Computer Systems & Organisation
Chapter 1: Computer Architecture and Memory
1. Introduction to Computer System Architecture
A computer system is an integrated set of hardware and software components designed to accept raw input data, process it according to stored instructions, and produce meaningful output information.
+-------------------------------------------------------+
| CENTRAL PROCESSING UNIT (CPU) |
| +--------------------+ +---------------------+ |
| | Control Unit (CU) |<---->| Registers (Fast) | |
| +--------------------+ +---------------------+ |
| ^ ^ |
| v v |
| +-------------------------------------------------+ |
| | Arithmetic and Logic Unit (ALU) | |
| +-------------------------------------------------+ |
+-------------------------------------------------------+
^ | ^
Control Bus | Address Bus | Data Bus |
=============+==================+==================+=========
v v v
+------------------+ +--------------------+
| Primary Memory | | Input / Output |
| (RAM & ROM) | | Interfaces |
+------------------+ +--------------------+
Functional Units of a Computer
- Input Unit: Converts human-readable data and instructions into binary form ($0$s and $1$s) understandable by the computer (e.g., Keyboard, Mouse, Scanner, Microphone).
- Central Processing Unit (CPU): Often termed the "brain" of the computer, it executes stored program instructions and coordinates all operations.
- Arithmetic Logic Unit (ALU): Performs mathematical calculations (addition, subtraction, multiplication, division) and logical comparisons ($<$, $>$, $==$, $\le$, $\ge$, $ e$, AND, OR, NOT).
- Control Unit (CU): Directs the entire flow of data and instructions within the system. It fetches instructions from memory, decodes them, and generates control signals for other hardware units.
- Registers: High-speed temporary storage cells situated inside the CPU chip (e.g., Program Counter (PC), Memory Address Register (MAR), Instruction Register (IR), Accumulator (ACC)).
- Output Unit: Translates processed binary data back into human-understandable visual, printed, or acoustic format (e.g., Monitor, Printer, Speaker).
- Storage Unit: Preserves programs and data for current and future retrieval.
2. System Interconnection: The System Bus
The CPU communicates with internal memory and external peripherals through collections of parallel conductive lines called a Bus:
| Bus Type | Direction | Functional Purpose |
|---|---|---|
| Data Bus | Bidirectional | Carries actual data values between the CPU, memory, and peripheral devices. |
| Address Bus | Unidirectional (CPU $ o$ Devices) | Transmits the physical memory address from which the CPU intends to read or to which it writes. |
| Control Bus | Bidirectional | Transmits synchronization signals, read/write commands, clock pulses, and interrupt signals. |
3. Computer Memory Hierarchy
Computer memory is structured in a pyramid based on speed, cost per bit, and storage capacity:
/\
/ \ CPU Registers (Fastest, Smallest, Highest Cost)
/====\
/ Cache\ SRAM Cache (L1, L2, L3)
/========\
/ RAM/ROM \ Primary Memory (Main Memory, DRAM)
/============\
/ Secondary \ Secondary Storage (SSD, HDD, Magnetic, Flash)
/================\
Units of Computer Memory
The smallest atomic unit of information is a Bit (Binary Digit: $0$ or $1$).
| Unit | Equivalent | In Bytes |
|---|---|---|
| Nibble | 4 bits | 0.5 Byte |
| Byte (B) | 8 bits | 1 Byte ($2^0$) |
| Kilobyte (KB) | 1024 Bytes | $2^{10}$ Bytes |
| Megabyte (MB) | 1024 KB | $2^{20}$ Bytes |
| Gigabyte (GB) | 1024 MB | $2^{30}$ Bytes |
| Terabyte (TB) | 1024 GB | $2^{40}$ Bytes |
| Petabyte (PB) | 1024 TB | $2^{50}$ Bytes |
| Exabyte (EB) | 1024 PB | $2^{60}$ Bytes |
4. Primary Memory: RAM vs. ROM
+--------------------+
| Primary Memory |
+--------------------+
/ \
/ \
+-------------+ +-------------+
| RAM (Vol) | | ROM (Non-V) |
+-------------+ +-------------+
/ \ / | \
SRAM DRAM PROM EPROM EEPROM
Key Differences between RAM and ROM
| Feature | Random Access Memory (RAM) | Read Only Memory (ROM) |
|---|---|---|
| Volatility | Volatile: Content disappears immediately when electrical power is cut. | Non-Volatile: Content permanently retained even when power is turned off. |
| Operation | Read and Write operations are equally fast. | Primarily Read operations; writes require specialized burning. |
| Role | Holds active OS processes, running programs, and working data. | Stores firmware, BIOS/UEFI bootloader routines (POST routine). |
| Subtypes | SRAM (Static RAM - faster, uses flip-flops) and DRAM (Dynamic RAM - uses capacitors, needs periodic refreshing). | PROM (Programmable), EPROM (Erasable via UV light), EEPROM (Electrically Erasable). |
Cache Memory
- Definition: Extremely high-speed buffer memory placed directly between the CPU and main memory (DRAM).
- Purpose: Minimizes the speed gap between high-frequency CPU cores (GHz) and relatively slower DRAM bus speeds.
- Principle: Exploits the Locality of Reference (Temporal: recently accessed data is likely to be accessed again; Spatial: nearby instructions will be needed soon).
- Levels: L1 (fastest, integrated inside core), L2 (slightly larger, dedicated per core), L3 (shared across cores).
5. Secondary Storage Devices
Secondary memory provides permanent, non-volatile, high-capacity storage for operating systems, installed applications, and user files:
- Solid State Drives (SSDs): Utilize NAND flash memory chips. No moving mechanical parts, near-instant access times, silent operation, and high shock resistance compared to mechanical HDDs.
- Hard Disk Drives (HDDs): Magnetic disks (platters) coated with magnetic material rotating at high RPM (5400 / 7200 RPM) read by electromagnetic heads. Higher capacity per rupee, but susceptible to mechanical shock.
- Optical Discs: CDs (700 MB), DVDs (4.7 GB to 8.5 GB), Blu-ray (25 GB to 50 GB) read and written using focused laser diodes.
- Flash Memory: USB Flash Drives and MicroSD cards using EEPROM flash transistors.
6. Software: System vs. Application
Hardware cannot perform tasks without software—a set of instructions programmed to achieve specific operations.
+----------------------+
| Computer Software |
+----------------------+
/ \
+----------------+ +-------------------+
| System Software| |Application Software|
+----------------+ +-------------------+
/ | \ / \
OS Device Utility General Customized
Drivers Tools Purpose Software
System Software
Controls internal hardware operations and provides a platform on which user applications run: - Operating System (OS): Core resource manager (Windows, macOS, Linux, Android) overseeing memory allocation, CPU scheduling, file management, and security. - Language Processors: Translators converting high-level human-readable code into binary machine code: - Assembler: Converts Assembly language mnemonic instructions into machine code. - Compiler: Scans the whole source program in one pass, generates executable object code, and flags all syntax errors together (e.g., C, C++, Rust). - Interpreter: Translates and executes source statements line-by-line. Halts execution at the very first syntax error (e.g., Python, Ruby). - Device Drivers: Specialized software enabling the OS to communicate with specific peripheral devices (printers, graphics cards, sound cards).
Application Software
Programs crafted to perform specific end-user productivity or commercial tasks: - General Purpose: Spreadsheets (MS Excel), Word Processors (MS Word), Web Browsers (Chrome, Firefox). - Customized/Tailored: School Management Software, Railway Reservation System, Hospital Inventory Software.
7. Board Exam Practice Questions & Solutions
Q1. Differentiate between Compiler and Interpreter with two points of distinction.
Answer:
1. A Compiler reads the entire high-level program at once and translates it into an independent machine-executable object file. In contrast, an Interpreter translates and executes the source code line-by-line.
2. In a compiler, all syntax errors are collected and reported together after translation. In an interpreter, execution halts immediately when the first syntax error is encountered, facilitating easier interactive debugging.
Q2. Arrange the following memory types in ascending order of access speed (slowest to fastest):
Main Memory (RAM), Secondary Storage (HDD), CPU Registers, Cache Memory
Answer:
Secondary Storage (HDD) < Main Memory (RAM) < Cache Memory < CPU Registers
Q3. Why is DRAM refreshed periodically while SRAM does not require refreshing?
Answer:
DRAM stores each bit of data as an electrical charge in a microscopic capacitor paired with a transistor. Because capacitors naturally leak electrical charge over time, DRAM circuits must be refreshed (recharged) periodically thousands of times per second. SRAM uses bistable cross-coupled flip-flop circuits (latches) that retain their state indefinitely as long as power is supplied, eliminating the need for periodic refreshing.