Skip to content

Operating Systems (Phase 1 §3)

Primary source: Caltech CS124 Spring 2024 (Donnie Pinkston).

This section is the OS theory + Linux-shaped practice layer of Phase 1. It sits after §2 — Computer Architecture (you need CPU/memory context) and before §4 — C++ and Parallel Computing (you will use processes, threads, and VM ideas when writing host and CUDA code).

Why it matters for AI hardware: Deployed stacks run on Linux (Jetson, ADAS, servers) or smaller RTOSes. Scheduling, virtual memory, I/O, and the user/kernel boundary are what you tune when chasing latency, debugging drivers, or reasoning about zero-copy camera → GPU paths.


How this folder is laid out

Everything you need is under this directory—there is no separate “side” tree next to Lectures/.

Location Role
Lectures/Lecture-NN.md Main notes for 26 topics (see index below).
Lectures/Lecture-Note-NN.md Optional deeper notes where present.
Lectures/demos/rt-demo/ Small user-space C demo tying Lectures 1–9 to runnable code (README).
Final-Test-Problems.md Five integration problems with explicit lecture cross-links.

Study flow: Read lectures in the thematic order below → use rt-demo after you finish L9 (optional but useful) → attempt Final-Test-Problems near the end of the section.


Course snapshot

Aspect Details
Base curriculum Caltech CS124 — concepts, slides, and pacing
Write-ups in this repo 26 markdown lectures (including capstone-style L25 and L26 extensions aligned with this roadmap)
Prerequisites C programming; Phase 1 §2 (architecture / memory hierarchy)
Classic hands-on (external) Pintos — Stanford teaching kernel (threads, user programs, VM, files)

Follow this order rather than skipping around; later lectures assume earlier vocabulary.

  1. System shape & boot (L1–L5) — history, UNIX I/O, traps and structure, microkernels, firmware/boot.
  2. Concurrency in the kernel model (L6–L9) — processes, threads, interrupt context, synchronization and deadlock.
    Optional: build and run rt-demo here to connect syscalls, scheduling, affinity, and pthread primitives to real code.
  3. Scheduling (L10–L12) — advanced sync, CPU scheduling, real-time and Linux schedulers.
  4. User/kernel boundary (L13–L14) — system calls, signals.
  5. Memory (L15–L20) — virtual memory, page tables, replacement, thrashing, Pintos VM discussion.
  6. Filesystems (L21–L24) — allocation, locking, SSDs, Pintos FS design, journaling.
  7. Integration (L25–L26) — Yocto capstone tie-in; eBPF / observability.

Lecture index (all topics)

# Topic Key concepts
1 Introduction & OS history Mainframes → time-sharing, virtualization, RTOS
2 OS components & UNIX I/O Syscalls, kernel/user mode, fds, pipes, shells
3 Traps, interrupts & structure Traps/faults, preemption, monolithic vs microkernel
4 Microkernels & exokernels Mach, L4, IPC, hybrid kernels
5 Bootstrap & firmware BIOS/UEFI, ACPI, chain loading; Linux kernel lectures tie-in to DT, modules
6 Process abstraction States, PCB, context switch, queues
7 Threads User vs kernel threads, models, Amdahl
8 Kernel stacks & interrupts Reentrancy, interrupt context, critical sections
9 Synchronization & deadlock Peterson, spinlocks, semaphores, deadlock
10 Advanced synchronization RCU, rwlocks, lock granularity
11 Process scheduling FCFS, RR, SJF, priority, MLQs
12 Real-time & Linux schedulers EDF, rate-monotonic, CFS
13 System calls Trap path, arguments, pointer checks
14 UNIX signals Handlers, masks, sigreturn
15 Virtual memory & MMU Paging, TLB, demand paging
16 Page tables & COW PTE bits, fork/vfork
17 Frame tables & replacement FIFO, optimal, Belady
18 Replacement policies LRU, clock, working set
19 Pintos VM design Project-oriented discussion
20 Allocation & thrashing Global vs local, working set
21 Filesystems Directories, inodes, allocation
22 File locking & SSDs flock, FTL, TRIM
23 Pintos file system design Project-oriented discussion
24 Journaling filesystems Crash consistency
25 Capstone: custom Linux images Yocto; pairs with Phase 2 embedded Linux
26 eBPF deep dive Verifier, maps, CO-RE, XDP, observability

Practice

  1. Final-Test-Problems.md — five problems (kernel build, PREEMPT_RT, ext4, boot chain, modules + DT); each points to specific lectures.
  2. Lectures/demos/rt-demo/ — one program for L1–L9 (scheduling, affinity, mlockall, pthread sync). Requires Linux or WSL.

Resources


AI / embedded relevance

OS idea Typical AI / edge use
Real-time scheduling Inference deadlines, sensor pipelines
Virtual memory & DMA Weights in RAM, camera → accelerator buffers
fds & I/O Cameras, CAN, logging
Process / thread model Separate daemons for capture, inference, control
User vs kernel Drivers vs userspace ML runtimes
eBPF Profiling, scheduler analysis, XDP filtering