Computer Systems

Follow one program from its bits through the processor, memory and OS

About this course

How a program actually runs — data representation, integer and floating-point arithmetic, instructions and the stack, processor pipelines, caches and virtual memory, linking and loading, and I/O at the system boundary.

What you will be able to do

  • Interpret one bit pattern as integer, character or floating-point value, and predict overflow and rounding
  • Trace control flow, function calls and stack frames through a machine-level program
  • Explain how a pipelined processor executes instructions, and identify where overlap causes hazards
  • Predict cache hits and misses from access patterns, and translate virtual addresses to physical ones
  • Describe how source files become a running image and how a program crosses the system boundary for I/O

What this course covers

  • Task contract and observable state
  • Machine state: addresses, values, and registers
  • Instruction semantics and read/write footprint
  • Complete execution trace
  • Testing the contract vs. testing the accumulator
  • Prefix invariant for array summation
  • Instruction count vs. elapsed time
  • Cache model specification and block transfer mechanics
  • Block address arithmetic: block number and byte offset
  • Spatial and temporal locality
  • LRU replacement and recency refresh on hits
  • Row-major matrix layout and loop-order address streams
  • Tiled (blocked) traversal to reduce working-set footprint
  • Abstract serial cost model and alignment boundary effects
  • Pipeline of representations: source to running image
  • Object file structure and unresolved references
  • Symbol resolution: scope, binding, and failure modes
  • Layout and virtual address assignment
  • Relocation: encoding references after layout
  • Loading: file vs. memory image and segment records
  • End-to-end execution trace and result verification
  • Instruction as a complete state transition
  • Indirect (register-addressed) load
  • Conditional branch and control flow graphs
  • Loop structure: setup, test, body, exit
  • Loop invariant and termination argument
  • Boundary cases: empty input, byte wrap, and static vs. dynamic instruction count
  • RISC-V fragment: byte-addressed PC and branch offset
  • Full adder and ripple-carry addition
  • Multiplexer selection vs. register storage
  • Ideal simultaneous state update rule
  • Write-enable control and inactive signals
  • FTMD4 instruction encoding and decoding
  • Program counter and branch control
  • Complete processor data path and correctness criterion
  • Set-based placement and collision
  • Address decomposition into tag, set index, and byte offset
  • Cache lookup: validity and tag equality as joint hit conditions
  • Associativity: ways, sets, and the fixed-capacity trade-off
  • LRU replacement and per-set recency tracking
  • Compulsory vs. conflict miss classification via shadow cache
  • Full 8-request two-way lookup worked example
  • Bit patterns require an explicit interpretation rule
  • Unsigned positional (binary) representation
  • Hexadecimal as a compact bit-pattern display
  • Two's complement signed interpretation
  • Character encoding and bit-flag interpretation
  • Byte order in multi-byte values
  • The complete decoding contract and round-trip discipline
  • Value, Representation, and External Effect
  • Library Buffering and the Flush Boundary
  • Controlled Entry: System Write Arguments and Return Value
  • Cursor Invariant for Short Writes
  • Device State: Submission, Completion, and Acknowledgment
  • Qualifying Success: Volatile vs. Durable Persistence
  • Accepted-Stage Conservation Identity
  • Continuations and the call/return mechanism
  • Calling conventions: caller/callee obligations
  • Stack frames: push, pop, and frame layout
  • Activations and recursive stack traces
  • Stack resource limits and failure modes
  • RISC-V calling convention comparison
  • Separating computation, control, and output
  • Pipe Eight model and five-stage pipeline structure
  • Latency, throughput, and the N+4 completion formula
  • Instruction identity packets and forwarding basics
  • Producer priority and the load-use stall limit
  • Branch misprediction flush and wrong-path recovery
  • Sequential retirement checker and negative-control validation
  • Array-sum capstone and instruction reordering
  • Address context: same number, different bytes
  • Virtual-to-physical address translation
  • Translation Lookaside Buffer (TLB) mechanics
  • Aliases: two virtual addresses, one physical byte
  • Fault types: not-present vs. protection fault
  • Stale TLB entries and invalidation
  • Hierarchical page tables and the eight-request capstone
  • Layout One storage model and alignment rules
  • Index-to-address stride formula
  • Alignment validity and memory-bound checks
  • Aliasing: two pointers to shared storage
  • Record layout: field offsets and padding
  • Composing array-of-records address formula
  • One-past boundary pointer and safe traversal
  • Capstone synthesis: layout, aliasing, and traversal
  • Whole Eight machine model and its boundaries
  • The missing store: register vs. memory obligation
  • Linking and relocation of symbolic references
  • Execution trace and loop invariant
  • Virtual-to-physical address translation and cache behaviour
  • Formatting and the output endpoint pipeline
  • End-to-end chain and diagnostic method
  • Bounded arithmetic and representation contracts
  • Column-by-column binary addition (the teaching adder)
  • Unsigned carry-out vs. signed overflow
  • Sign-based signed overflow detection rule
  • Zero extension and sign extension (widening)
  • Order of widening vs. addition (information loss)
  • Operation contracts: teaching model, machine instruction, and source language
  • Checked addition with pre-computation threshold tests
  • Floating-point representation contract and mental model
  • Decoding floating-point fields: sign, exponent, significand
  • Local spacing and nearest-with-ties-to-even rounding
  • Rounding site location and non-associativity of rounded addition
  • Special encodings: subnormals, zeros, infinities, and NaNs
  • Connection to real formats and closing summary
  • Cancellation and information loss at conversion

Syllabus

  1. Programs, Bits and Numbers

    1. L1 · What Happens When a Program Runs?
    2. L2 · Bits, Bytes, and Interpretations
    3. L3 · Integer Arithmetic Has Boundaries
    4. L4 · Floating Point Is a Number System
  2. Machine-Level Programs

    1. L5 · Instructions and Control Flow
    2. L6 · Functions, Calls, and the Stack
    3. L7 · Arrays, Pointers, and Data Layout
  3. The Processor

    1. L8 · From Logic to a Working Processor
    2. L9 · Pipelines: Overlap Without Confusion
  4. Memory

    1. L10 · Memory Hierarchy and Locality
    2. L11 · Caches: Mapping, Misses, and Trade-offs
    3. L12 · Virtual Memory and Address Translation
  5. Linking, I/O and the Whole Machine

    1. L13 · From Source Files to a Running Image
    2. L14 · I-O and the System Boundary
    3. L15 · One Program, the Whole Machine