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
Programs, Bits and Numbers
- L1 · What Happens When a Program Runs?
- L2 · Bits, Bytes, and Interpretations
- L3 · Integer Arithmetic Has Boundaries
- L4 · Floating Point Is a Number System
Machine-Level Programs
- L5 · Instructions and Control Flow
- L6 · Functions, Calls, and the Stack
- L7 · Arrays, Pointers, and Data Layout
The Processor
- L8 · From Logic to a Working Processor
- L9 · Pipelines: Overlap Without Confusion
Memory
- L10 · Memory Hierarchy and Locality
- L11 · Caches: Mapping, Misses, and Trade-offs
- L12 · Virtual Memory and Address Translation
Linking, I/O and the Whole Machine
- L13 · From Source Files to a Running Image
- L14 · I-O and the System Boundary
- L15 · One Program, the Whole Machine