CS24 Spring 2017 - Lecture Slides and Videos

Slides are made available as PDF files. All lectures are recorded in .mp4 format. Each recording is around 30MB in size.

The previous year's lecture slides and recordings are available here.

Debugging Part 1: General Debugging Approaches [slides] [recording]
Bug = Defect + Failure. Assertions. Reproducing and isolating failures. Keeping a debugging log. Understanding the system. Disabling code: commenting out code, using preprocessor directives. Creating simple test cases. Printing out details: flushing output, making lines unique, disabling debug output. Verification, regressions.
Debugging Part 2: Debugging Tools [slides] [recording]
GDB, Valgrind. Setup for debugging.

Lecture 1: 2017-04-03 [slides] [recording]
Introduction, course overview. Signals and logic gates. Overview of instruction set architecture. Data representation for unsigned integers, and two's complement signed integers. Unsigned addition.
Lecture 2: 2017-04-05 [slides] [recording]
Basic processor components. Basic processor structure. Writing a program in machine code. C logical and bitwise operations.
Lecture 3: 2017-04-07 [slides] [recording]
Branching instruction support. Memory architectures. Harvard architecture vs. Von Neumann architecture. Register file and main memory. Load/Store architecture vs. operand types.

Lecture 4: 2017-04-10 [slides] [recording]
Subroutines. Stacks. Stack frames, frame pointers. x86-64 (aka "Intel 64") overview.
Lecture 5: 2017-04-12 [slides] [recording]
x86-64 instructions. Operand types, memory addressing modes. The "System V AMD64 ABI" calling convention for C functions: caller-save vs. callee-save registers, passing arguments and return-values.
Lecture 6: 2017-04-14 [slides] [recording]
x86-64 implementation of C global variables, local variables, and C functions with arguments and return-values. Position-Independent Code (PIC). The memory heap, malloc() and free(). Overview of C arrays, array indexing and pointer arithmetic.

Lecture 7: 2017-04-19 [slides] [recording]
Vector-Add example: x86-64 looping, array indexing. Calling malloc() from x86-64. Linked lists. Location of stack and heap in process memory layout. Explicit heap allocators: fragmentation, coalescing free blocks, data alignment.
Lecture 8: 2017-04-21 [slides] [recording]
Allocation strategies: first-fit, last-fit, best-fit. Implicit free-lists, explicit free-lists. C structs, unions. Data alignment and optimization. Buffer overflows and overflow exploits. Array bounds-checking. Introduction to higher-level language facilities.

Lecture 9: 2017-04-24 [slides] [recording]
Implicit allocators, indirection and references. Garbage collection algorithms: mark-and-sweep, stop-and-copy, generational garbage collection. Reference counting.
Lecture 10: 2017-04-26 [slides] [recording]
Object-oriented programming model. Objects and instance members. Classes and static members. Polymorphism, virtual functions, static and dynamic dispatch.
Lecture 11: 2017-04-28 [slides] [recording]
Exception handling. C setjmp()/longjmp() functions. Exception mechanisms: stack cutting, exception tables and stack unwinding, tradeoffs.

Lecture 12: 2017-05-01 [slides] [recording]
Midterm review.
Lecture 13: 2017-05-03 [slides] [recording]
Physical constraints on memory. Memory technologies: SRAM, DRAM, magnetic disks, Solid State Drives (SSDs).
Lecture 14: 2017-05-05 [slides] [recording]
Caching: motivations, general approach. Memory hierarchy. Cache design and layout. Direct-mapped caches, fully associative caches, set-associative caches.

Lecture 15: 2017-05-08 [slides] [recording]
Direct-mapped caches, fully associative caches, set-associative caches (cont). Cache performance analysis: modeling and testing performance. Cache utilization and memory mountain. Impact of multi-core on hardware caching.
Lecture 16: 2017-05-10 [slides] [recording]
MSI cache coherence protocol. Multi-core caching protocols: MESI, MOSI, MOESI, MESIF. Multicore cache performance issues: false sharing, ping-ponging. Virtualization: virtual processors, processes, process context. Context-switch mechanism.
Lecture 17: 2017-05-12 [slides] [recording]
Virtualization: control process, privilege levels, operating modes. Exceptional control flow: interrupts, traps, faults, aborts. x86-64 privilege modes, gates, INT and IRET instructions. Operating systems and kernels.

Lecture 18: 2017-05-15 [slides] [recording]
UNIX operating system calls via x86-64 traps. Direct Memory Access (DMA) and DMA transfers. User-mode exceptional flow control: UNIX signals, signal handlers.
Lecture 19: 2017-05-17 [slides] [recording]
UNIX signal handlers and reentrancy. Guranteed-reentrant UNIX functions. Process "pending" and "blocked" signal-masks. sigsetjmp(), siglongjmp(), and signal masks. UNIX process model: process IDs, forking processes, process termination status, reaping zombie processes.
Lecture 20: 2017-05-19 [slides] [recording]
Signal handlers and multiple signals. Operation of execve(). New program's stack layout: environment, command-line arguments. Command shells, fork() and execve(). UNIX process model implementation: states (ready, running, blocked, suspended, ...).

Lecture 21: 2017-05-22 [slides] [recording]
Process Control Blocks. Process management operations. Scheduling. Process behavior categories: interactive, long-running/compute-intensive, real-time. Scheduling algorithms: Round Robin, Shortest Jobs First.
Lecture 22: 2017-05-24 [slides] [recording]
Scheduling algorithms: Earliest-deadline first, multilevel feedback queues. Introduction to virtual memory and address translation. Memory management unit. Isolated process address-spaces. Shared memory. Fast context-switches.

Lecture 23: 2017-05-31 [slides] [recording]
Disk-backed virtual memory. Page-faults and pagefiles. Memory-mapping files with UNIX mmap(). Page permissions and general protection faults. Translation Lookaside Buffers (TLBs). Multi-level page tables: page directories, page tables.
Lecture 24: 2017-06-02 [slides] [recording]
x86-64 page directory entries and page table entries. Translation Lookaside Buffers (TLBs), TLB hits, TLB misses, partial TLB hits. Linux process memory layout: kernel code/data region, process virtual memory structures, resolving faults.

Lecture 25: 2017-06-05 [slides] [recording]
The anonymous file. Shared memory objects. Private memory objects, private copy-on-write (COW). fork() and private-COW. execve() and Linux process virtual memory structs.
Lecture 26: 2017-06-07 [slides] [recording]
Final exam review.