

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


From instruction set to cycles, caches and parallelism Computer Science | Undergraduate (Level 5) | December 2026
WHAT IS INSIDE
An instruction set architecture is the contract between hardware and compiler: registers, addressing modes, data types and the instruction formats. RISC designs favour fixed-length instructions, load-store addressing and many registers so that pipelining stays simple; CISC designs allow memory operands and richer instructions, trading decode complexity for code density. The exam distinction is not which is faster but which makes which optimisation cheap.
Calling conventions , the stack frame and the role of the program counter and link register define how procedures work, and they explain most assembly questions. Addressing modes - immediate, register, base plus offset, PC-relative - decide whether code is position independent and how many instructions a loop costs. Counting instructions and cycles for a short loop is the standard calculation, and the answer must separate instruction count from cycles per instruction.
The single-cycle datapath executes one instruction per clock, so the clock period is set by the slowest instruction - usually a load. Multicycle designs break execution into steps and reuse hardware, which shortens the clock but adds registers and control states. The control unit is either hardwired or microprogrammed, and the choice trades flexibility against speed.
A five-stage pipeline (fetch, decode, execute, memory, write back) overlaps instructions, so ideal throughput is one instruction per cycle, but structural , data and control hazards stall it. Data hazards are handled by forwarding , with a one-cycle load-use stall when forwarding cannot help; control hazards by branch prediction, delay slots or flushing. Speedup is limited by the unpipelined fraction and by pipeline depth, and a deeper pipeline raises both throughput and the penalty of a misprediction.
Computer Architecture: Datapath, Memory Hierarchy and Pipelining
Locality - temporal and spatial - is why a hierarchy works: registers, L1, L2, L3, main memory and disk, each an order of magnitude slower and larger. A cache is described by capacity, block size, associativity, replacement policy and write policy. Direct mapped caches have one candidate block and simple indexing but suffer conflict misses; fully associative caches have no conflict misses but need comparators on every access; set-associative designs are the compromise.
The three C s - compulsory, capacity and conflict misses - organise any answer about miss rates, and block size trades compulsory misses against capacity misses. Write-through keeps memory coherent at the cost of traffic; write-back reduces traffic but needs dirty bits and coherence handling. Virtual memory extends the same logic with page tables and a TLB, and its costs are page faults rather than cache misses, which is why the two must not be confused in an exam answer.
Instruction-level parallelism is extracted by pipelining, multiple issue, out-of-order execution and speculation. Scoreboarding and Tomasulo track dependencies and rename registers to remove false ones, while reorder buffers keep precise exceptions. The limits are true data dependencies and branch misprediction, so the returns to wider issue diminish quickly.
Multicore and SIMD move parallelism up a level, but shared memory introduces cache coherence and consistency questions. Snooping and directory protocols keep caches coherent, and the memory consistency model decides what a program may assume about the order of writes. Performance questions about multicore therefore have to name contention, false sharing and synchronisation cost, not just core count.
Three shapes dominate. Trace the algorithm : show the state after each step in a table, then state the final result and the complexity - a trace without a complexity statement is half an answer. Prove or justify : state the invariant, show it holds at initialisation, during each iteration and at termination. Design and compare : give the data structure, the operations with their costs, the trade-off, and one case where the alternative would be worse.