Interprets instructions and controls the fetch-execute cycle
Registers (ultra-fast storage inside CPU):
| Register | Full Name | Purpose |
|---|---|---|
| PC | Program Counter | Holds address of next instruction to fetch |
| MAR | Memory Address Register | Holds address being accessed in memory |
| MDR/MBR | Memory Data Register | Holds data just read from or about to be written to memory |
| CIR | Current Instruction Register | Holds the instruction currently being decoded/executed |
| ACC | Accumulator | Holds results of ALU operations |
| SR | Status Register | Holds flags (carry, zero, negative, overflow) |
System clock: Generates regular timing pulses. Every operation takes a fixed number of clock cycles. **Clock speed** (MHz/GHz) = cycles per second. Higher clock speed → more instructions per second (generally).
2. The Fetch-Execute Cycle
Every CPU instruction follows this cycle:
Fetch phase:
MAR ← [PC] (copy contents of PC to MAR)
MDR ← [memory(MAR)] (fetch instruction from memory at address in MAR)
PC ← PC + 1 (increment PC to point to next instruction)
CIR ← [MDR] (copy instruction from MDR to CIR for decoding)
Decode phase:
CU decodes the instruction in CIR (splits into opcode + operand)
Execute phase:
Instruction is executed by ALU, CU, or I/O controllers
Interrupts: CPU periodically checks for interrupt signals (from I/O devices, timer, errors). If interrupt: finish current instruction → save state → execute interrupt service routine (ISR) → restore state → resume.
3. Factors Affecting CPU Performance
Clock speed: More cycles per second → faster execution. Measured in GHz. Limit: heat generation.
Number of cores: Multiple cores can execute different program threads simultaneously. Quad-core = 4 independent processors on one chip.
Cache size: Ultra-fast memory between CPU and RAM. L1 cache (fastest, smallest, on chip) → L2 → L3 (largest, slowest, sometimes shared between cores). Larger cache → more instructions/data immediately available → fewer slow RAM accesses.
Bus width: Width of data bus (bits) = amount of data transferred per cycle. 64-bit bus transfers 64 bits at once.
Pipelining: Overlapping fetch-execute cycles. While one instruction executes, the next is decoded and the one after that is fetched. Increases throughput (instructions per second) without increasing clock speed.
Simultaneous Multi-Threading (Hyper-Threading): Each physical core appears as two logical cores to the OS — more efficient use of CPU resources.
Stage 2: Mid-Lesson Concept Video
Inserted into lesson flow using deterministic content sectioning (split by nearest heading).
Concept Breakdown
60-120 sec
Teach the core concept step-by-step with at least one worked explanation.
Placed in the middle of the lesson flow.
Dry-run assets generated
Written lesson and quiz remain available while this stage video is being prepared.
Principle of locality: Programs tend to access nearby addresses and repeat accesses to recently used data → cache effectiveness.
Virtual memory: OS uses part of HDD/SSD as extension of RAM when RAM is full. Much slower than RAM (involves disk access). **Thrashing:** Excessive swapping between RAM and virtual memory → severe performance loss.
5. Buses
The bus is a shared communication pathway connecting CPU, memory, and I/O.
Three buses:
| Bus | Direction | Carries |
|---|---|---|
| Address bus | CPU → (one-way) | Memory address to access |
| Data bus | Bidirectional | Data being transferred |
| Control bus | Bidirectional | Control signals (read, write, interrupt, clock) |
Address bus width: Determines addressable memory. 32-bit address bus → 2³² = 4 GB maximum address space. 64-bit → 16 exabytes (practically unlimited).
Data bus width: Determines data throughput per transfer. 64-bit data bus = 8 bytes per transfer.
5Buses: address (one-way, carries address), data (bidirectional, carries data), control (signals)
6HDD (mechanical, cheap, slow) vs SSD (flash, fast, expensive, no moving parts)
Pakistan Example
CPU Architecture in Pakistan's Supercomputer (NESCOM HPC)
Pakistan's National Engineering and Scientific Commission (NESCOM) operates high-performance computing (HPC) clusters used for weapons simulation and weather modelling. These systems use multi-core processors (Intel Xeon, AMD EPYC with 64+ cores) where parallel execution across cores is critical — a direct application of multi-core CPU architecture. Each core has its own L1/L2 cache (fast, private) with a shared L3 cache across cores. The fetch-execute cycle happens billions of times per second on each core. PTCL's data centres in Islamabad use server-grade CPUs with large L3 caches (up to 192 MB on AMD EPYC) to reduce the latency of database queries — the cache hierarchy keeps frequently accessed telecom customer records available near the processor without slow RAM accesses.
Quick Revision Infographic
Computer Science — Quick Revision
Hardware and Architecture
Key Concepts
1Registers: PC (next instruction address), MAR (memory address), MDR (data to/from memory), CIR (current instruction), ACC (ALU result)
5Buses: address (one-way, carries address), data (bidirectional, carries data), control (signals)
6HDD (mechanical, cheap, slow) vs SSD (flash, fast, expensive, no moving parts)
Pakistan Example
CPU Architecture in Pakistan's Supercomputer (NESCOM HPC)
Pakistan's National Engineering and Scientific Commission (NESCOM) operates high-performance computing (HPC) clusters used for weapons simulation and weather modelling. These systems use multi-core processors (Intel Xeon, AMD EPYC with 64+ cores) where parallel execution across cores is critical — a direct application of multi-core CPU architecture. Each core has its own L1/L2 cache (fast, private) with a shared L3 cache across cores. The fetch-execute cycle happens billions of times per second on each core. PTCL's data centres in Islamabad use server-grade CPUs with large L3 caches (up to 192 MB on AMD EPYC) to reduce the latency of database queries — the cache hierarchy keeps frequently accessed telecom customer records available near the processor without slow RAM accesses.
SeekhoAsaan.com — Free RevisionHardware and Architecture Infographic
Stage 3: End-of-Topic Summary Video
End the topic with a concise recap of key takeaways, formulas, and revision reminders.
Summary
30-60 sec
Provide a concise revision recap with key formulas/definitions and next steps.
Placed near the end of the topic journey.
Dry-run assets generated
Written lesson and quiz remain available while this stage video is being prepared.