CS124 Spring 2024 - Lecture Slides

Slides are made available as PDF files.

Lecture 1: 2024-04-01 [slides]
Introduction, course overview. Operating systems: general principles, history from 1950s to present. Mainframes. Batch processing systems. Multiprogramming, time-sharing and multitasking. Minicomputers. Microcomputers. Multiprocessor systems. Virtualization, emulation, hypervisors. Embedded operating systems. Real-time operating systems: soft real-time vs. hard real-time.
Lecture 2: 2024-04-03 [slides]
Operating System components: program execution, resource allocation, filesystems, I/O services, communication, accounting, error detection, protection/security, system calls. Processor operating modes: kernel mode, user mode. Hierarchical protection domains/protection rings. Virtual memory: kernel space, user space. UNIX file IO: file descriptors, stdin/stdout/stderr, I/O redirection, pipes. File descriptor duplication and manipulation. Command shell operation.
Lecture 3: 2024-04-05 [slides]
Traps for system calls. Exceptional control flow: traps, interrupts, faults, aborts. IA32 double-fault and triple-fault aborts. Cooperative multitasking, preemptive multitasking. Hardware timer support. IA32 hardware Advanced Programmable Interrupt Controller (APIC). OS structure: separation of policy and mechanism, simple structure (MS-DOS), monolithic kernels, layered structure (the THE OS), modular kernels.

Lecture 4: 2024-04-08 [slides]
Microkernels. Liedtke's Minimality Principle. Message-passing IPC. CMU Mach. L4 family of microkernels. Hybrid kernels. Exokernels.
Lecture 5: 2024-04-10 [slides]
Bootstrap process, bootloaders, firmware. PC BIOS. Master Boot Record (MBR). Chain loading. IA32 bootstrap process. Plug-and-play systems. Intel MultiProcessor Specification, Advanced Configuration and Power Interface (ACPI). Unified Extensible Firmware Interface (UEFI): preboot environment, EFI System Partition, GUID partition tables.
Lecture 6: 2024-04-12 [slides]
The process abstraction. Process states: new, ready, running, blocked, suspended, terminated. Process control block (aka task control block, task struct). Process context switch. Process management: run queue (aka ready queue), wait queues. Process scheduling: long-term scheduling (aka job scheduling), medium term scheduling, short-term scheduling.

Lecture 7: 2024-04-15 [slides]
The thread abstraction. Threads and performance: responsiveness, scalability, resource sharing, economy. Concurrency vs. parallelism, Amdahl's Law, Gustafson-Barsis' Law. Threads and abstraction: blocking vs. non-blocking operations. User-space threading vs. kernel threads. Multithreading models: many-to-one model (i.e. user-space threading), one-to-one model (i.e. kernel threading), many-to-many threading model (a.k.a. hybrid threading model). Scheduler activations, upcalls, upcall handlers.
Lecture 8: 2024-04-17 [slides]
Kernel stacks. Kernel stack initialization. Kernel control paths, reentrant kernels. Process context vs. interrupt context. IA32 protected-mode interrupt mechanics. Preventing or allowing overlapping interrupt handlers. Linux and overlapping interrupt handlers: critical interrupts, noncritical interrupts, noncritical deferrable interrupts, softirqs. Preemptive vs. non-preemptive kernels: scheduled vs. forced process-switches, dispatch latency. Race conditions, a.k.a. Heisenbugs. Critical sections, mutual exclusion.
Lecture 9: 2024-04-19 [slides]
Software mutual exclusion: Peterson's algorithm. Hardware mutual exclusion: optimization barriers, memory barriers, disabling local interrupts. Spin locks. Deadlocks. Deadlock conditions: mutual exclusion, hold and wait, no preemption, circular wait. Deadlock prevention, deadlock avoidance, deadlock detection and resolution. Semaphores: counting semaphores, binary semaphores. Mutex locks. Thinking like a kernel programmer. Pintos Threads project guidance.