| Register | Purpose |
|---|---|
| Program Counter (PC) | Holds the address of the next instruction to fetch. |
| Memory Address Register (MAR) | Provides the address for a memory read or write. |
| Memory Data Register (MDR) | Temporarily stores data read from or to be written to memory. |
| Accumulator (ACC) | Primary operand/result register for the ALU. |
| Index Register (IX) | Used for address calculation (e.g., array indexing). |
| Status/Flag Register | Contains condition flags (Zero, Carry, Overflow, Interrupt Enable, etc.). |
The three main buses that connect the CPU to memory and I/O are:
An interrupt is a signal that temporarily suspends the normal sequential execution of a program so that the CPU can service an event that requires immediate attention. After the interrupt service routine (ISR) finishes, the CPU restores the saved state and continues the original program.
| Type | Source | Typical use |
|---|---|---|
| Hardware interrupt | External devices (keyboard, mouse, network card, disk controller) | Notify CPU that data is ready or a device needs service. |
| Software interrupt (trap) | Program instruction (e.g., INT on x86, syscall on ARM) | Request operating‑system services such as file I/O. |
| Timer interrupt | Internal timer circuit | Implement time slicing for pre‑emptive multitasking. |
| Exception (fault) | CPU detects an illegal operation (divide by zero, page fault, invalid opcode) | Transfer control to an error‑handling routine. |
INTERRUPT_VECTOR 0x09 ; keyboard IRQ vector
ISR_KEYBOARD:
PUSH AX ; save registers used by ISR
IN AL, 0x60 ; read scan code from keyboard port
CALL PROCESS_KEY ; store the code in a buffer
POP AX ; restore registers
IRET ; return from interrupt (restores PC & flags)
| Aspect | Effect of interrupts |
|---|---|
| CPU utilisation | Higher utilisation because the CPU works only when there is useful work, not while busy‑waiting. |
| Latency | Interrupt latency = time from IRQ assertion to start of ISR; depends on pipeline depth and masking. |
| Throughput | Generally increased, but excessive interrupt frequency can cause an “interrupt storm” and degrade throughput. |
| Overhead | Saving/restoring context and vector lookup add a few µs to each interrupt; this overhead is accounted for in real‑time designs. |
IE = 1 allows IRQs, IE = 0 masks them.IMR on x86) use a bit mask to enable/disable individual device lines.LSL #n, R – logical shift left (fills with 0s).LSR #n, R – logical shift right (fills with 0s).ASL #n, R – arithmetic shift left (same as LSL).ASR #n, R – arithmetic shift right (preserves sign bit).Example: LSL #3, R0 ; R0 = R0 << 3 turns binary 0000 1010₂ into 0101 0000₂.
; Enable all interrupts
OR STATUS, #0x01
; Disable interrupts (critical section)
AND STATUS, #0xFE
; ---------- Source (Pass 1) ----------
START: LOAD R1, NUM1 ; R1 ← NUM1
ADD R1, NUM2 ; R1 ← R1 + NUM2
STORE R1, RESULT ; RESULT ← R1
HALT
NUM1: .WORD 0x0014
NUM2: .WORD 0x000A
RESULT: .WORD 0x0000
; ---------- Symbol table (Pass 1) ----------
START = 0x0000
NUM1 = 0x000C
NUM2 = 0x000E
RESULT = 0x0010
; ---------- Object code (Pass 2) ----------
0x0000: 01 01 0C ; LOAD R1, [0x000C]
0x0003: 03 01 0E ; ADD R1, [0x000E]
0x0006: 02 01 10 ; STORE R1, [0x0010]
0x0009: FF ; HALT
0x000C: 14 00 ; NUM1 = 20
0x000E: 0A 00 ; NUM2 = 10
0x0010: 00 00 ; RESULT (initially 0)
PUSH/POP – save/restore registers.IN/OUT – port‑I/O.CLI/STI – clear/set the interrupt flag.IRET – return from interrupt (restores PC & flags).| Concept | Definition | Typical example |
|---|---|---|
| RISC vs. CISC | RISC uses many simple, fixed‑length instructions that are easy to pipeline; CISC packs more work into fewer, variable‑length instructions. | RISC – ARM v8, MIPS; CISC – Intel x86‑64, AMD 64. |
| Pipelining | Overlaps the fetch, decode, execute and write‑back stages so that several instructions are in different stages simultaneously. | 5‑stage pipeline in a typical MIPS processor; hazards are resolved with stalls or forwarding. |
| Parallel processing (multi‑core) | Two or more independent CPU cores share the same memory system and interrupt controller; each core has its own local mask and may have a private vector table. | Quad‑core Intel Core i5 – each core can handle separate IRQs, coordinated by an APIC. |
| Virtual machines & hypervisors | Software layers that emulate a complete hardware platform; virtual devices generate “virtual interrupts” that the hypervisor maps to physical IRQs. | VMware ESXi delivering virtual PCI‑e interrupts to a guest OS. |
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.