Skip to content
Operating Systems
Demo: Nuts and Bolts
Initializing search
cs-pub-ro/operating-systems
Home
Live
Full
Info
Assignments
Extra
Operating Systems
cs-pub-ro/operating-systems
Home
Live
Live
Lectures
Lectures
01: The Software Stack
01: The Software Stack
Demos
Demos
Pitch: Four Small Surprises
Pitch: Four Small Surprises
Demo: Two Ways to Build the Same String
Demo: char *str and char str[]
Demo: The Same Command, Three Times
Demo: An Assignment That Does Nothing
Demo: Hello, World at Five Heights
Demo: What a Security Guarantee Costs
Demo: Four Containers, Three Protocols
Slides
02: OS Types and the OS Interface
02: OS Types and the OS Interface
Demos
Demos
Demo: The Kernel Does the Heavy Lifting
Demo: Building an Operating System
Demo: Building an Operating System
Demo: Build Hello, World with Unikraft
Demo: The System Call Interface
Demo: The System Call Interface
Demo: What a System Call Costs
Demo: Talking to the Kernel Directly
Demo: Privileged Instructions Fault in User Mode
Demo: Optimizing the OS Interface
Demo: Optimizing the OS Interface
Demo: Buffering in User Space
Demo: Moving Work into the Kernel with sendfile()
Slides
03: Memory Operations
03: Memory Operations
Demos
Demos
Demo: Why Care About Memory?
Demo: Why Care About Memory?
Demo: Memory You Do Not See Is Working for You
Demo: Where Data Sits Decides Speed
Demo: Memory You Forget to Free Is Gone
Demo: Memory Is What Runs Out
Demo: Memory Operations
Demo: Memory Operations
Demo: The Five Operations
Demo: Permissions Are Per Area
Demo: The Process Address Space
Demo: The Process Address Space
Demo: The Address Space, Line by Line
Demo: When Memory Is Allocated
Demo: When Memory Is Allocated
Demo: Where Every Kind of Variable Lives
Demo: Run-Time Allocation
Demo: Run-Time Allocation
Demo: Watching the Dynamic Areas Change
Demo: What malloc() Asks the Kernel For
Slides
04: Virtual Memory
04: Virtual Memory
Demos
Demos
Demo: Addresses Are Not Places
Demo: Addresses Are Not Places
Demo: Allocate 10 TB
Demo: A Browser With 1.5 TB of Memory
Demo: The Same Address, Twice
Demo: What We Already Know
Demo: What We Already Know
Demo: malloc() Under strace
Demo: Allocation Changes the List of Areas
Demo: Virtual Memory and Physical Memory
Demo: Virtual Memory and Physical Memory
Demo: Reserving Costs Nothing
Demo: Two Sizes for Every Process
Demo: Reserve, Allocate, Map
Demo: Reserve, Allocate, Map
Demo: One Fault per Page, Once
Demo: Touch Half, Pay for Half
Demo: Pages and the Page Table
Demo: Pages and the Page Table
Demo: Reading Your Own Page Table
Slides
05: Paging
05: Paging
Demos
Demos
Demo: Billions of Faults
Demo: Billions of Faults
Demo: Ten Billion Page Faults
Demo: More Resident Memory Than Memory
Demo: Two Views of One Address Space
Demo: Two Views of One Address Space
Demo: Which View Each Step Edits
Demo: One Address Space, Counted Both Ways
Demo: The Page Fault
Demo: The Page Fault
Demo: Minor and Major, on the Same File
Demo: Eight Accesses, Two Kinds of No
Demo: Where Frames Come From
Demo: Where Frames Come From
Demo: The Page Cache
Demo: Swap, in a Box
Demo: Memory Sharing
Demo: Memory Sharing
Demo: fork() and Copy-on-Write
Demo: RSS, PSS and USS for One Process
Demo: Ten Processes, Four Ways
Demo: Storing the Page Table
Demo: Storing the Page Table
Demo: How Much Page Table a Process Has
Demo: What a TLB Miss Costs
Slides
06: Processes and Threads
06: Processes and Threads
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: One Program on Many Cores
Demo: Processes and Threads in the System
Demo: Running an Application
Demo: Running an Application
Demo: Threads Share the Address Space
Demo: Threads
Demo: Threads
Demo: Instruction Pointer and Stack Pointer
Demo: A New Stack per Thread
Demo: Process Operations
Demo: Process Operations
Demo: An Orphan Process
Demo: Creating a Process with posix_spawn()
Demo: A Zombie Process
Demo: Thread Operations
Demo: Thread Operations
Demo: Create and Join
Demo: fork() and exec()
Demo: fork() and exec()
Demo: fork() and exec() by Hand
Demo: Tracing Process Creation
Slides
07: Scheduling
07: Scheduling
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: The Times of a Process
Demo: The Times of a Started Process
Demo: Threads Against CPUs
Demo: Processes, Recapped
Demo: Processes, Recapped
Demo: fork() and exec() by Hand
Demo: An Orphan Process
Demo: Creating a Process with posix_spawn()
Demo: A Zombie Process
Demo: Copy-on-Write
Demo: Copy-on-Write
Demo: The Page Faults of a Fork
Demo: Thread States
Demo: Thread States
Demo: A Thread Changing State
Demo: Showing Thread States
Demo: The Context Switch
Demo: The Context Switch
Demo: Context Switches and the Page Cache
Demo: Counting Context Switches
Demo: Queues, Waiting and Load
Demo: Queues, Waiting and Load
Demo: The Load Average
Demo: Time in the Ready Queue
Demo: Nuts and Bolts
Demo: Nuts and Bolts
Demo: The Nice Value
Slides
08: Concurrency
08: Concurrency
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: One Sum, Six Programs
Demo: Root Causes
Demo: Root Causes
Demo: One Core, Many Cores
Demo: Partitioning and Synchronization
Demo: Partitioning and Synchronization
Demo: Contention in the Kernel
Demo: A Shared List
Demo: Problems with Synchronization
Demo: Problems with Synchronization
Demo: A Deadlock
Demo: Granularity of a Critical Section
Demo: Time of Check to Time of Use
Slides
09: I/O Interface
09: I/O Interface
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: How Much I/O a Process Does
Demo: One Megabyte, Four Ways
Demo: Processes and the Outside World
Demo: Processes and the Outside World
Demo: List Open Files
Demo: The Process I/O Interface
Demo: The Process I/O Interface
Demo: I/O Operations on a FIFO
Demo: I/O Operations on a File
Demo: The File Descriptor Table
Demo: The File Descriptor Table
Demo: The Size of the File Descriptor Table
Demo: Which Entry a New Channel Gets
Demo: Types of I/O Channels
Demo: Types of I/O Channels
Demo: One Process, Every Kind of Channel
Demo: Five Ways from One Process to Another
Demo: File Channel Internals
Demo: File Channel Internals
Demo: Who Shares the File Pointer
Demo: Open Permissions
Demo: File Channel Operations
Demo: File Channel Operations
Demo: The File Pointer and the Size
Demo: Size Is Not Space
Slides
10: Inter-Process Communication
11: Network I/O
12: Inter-Application Interaction
Labs
Labs
01: The Software Stack
01: The Software Stack
Demo: Copy String
Demo: printf vs write
01: Implement strlen(), strcpy(), strcat(), memcpy()
02: XOR Encryption — Build and Use a Library
03: Stream Ciphers — Four Ways to Link the Same Program
Bonus: Stream Ciphers — One Executable per Cipher
Bonus: Make Your Own Library — Static vs Dynamic Linking
02: The Operating System Interface
02: The Operating System Interface
Demo: The write System Call
01: The getpid System Call
02: The nanosleep System Call
Bonus: clock_gettime and time
Bonus: Plugging _putchar() Into a Custom printf
03: Memory Operations
03: Memory Operations
Demo: Copy a File Using a Global Buffer
Demo: Copy a File Using a Local Buffer
Demo: Copy a File Using a Heap Buffer
Demo: Copy a File Using an mmap Buffer
01: XOR-Encrypt a File With a Fixed Key
02: Sort Products by Price
03: A Growable In-Memory Database
04: Reverse the Lines of a File
Bonus: A Shrinking In-Memory Database
Bonus: Tune malloc() for a Frame Pipeline
04: Memory Debugging
04: Memory Debugging
Demo: Debugging an In-Memory Database
Demo: Finding a Memory Leak With Valgrind
01: The Config Parser That Forgets
02: The Program That Is Right and Still Broken
03: The Histogram That Counts Too Much
04: The Report That Crashes in the C Library
Bonus: The JSON Parser With a Heap Buffer Overflow
Bonus: (Hard) No Source Code Allowed
Bonus: (Hard) The Symbol Table With Two Bugs
05: Memory Security
05: Memory Security
Demo: Flip the Lock (heap-0)
Demo: Set the Access Level (heap-1)
01: Overflow a Heap Buffer (heap-0)
02: Overflow to an Exact Value (heap-1)
03: Hijack a Function Pointer (heap-2)
04: Use-After-Free (heap-3)
Bonus: Cross Two Structs (heap-havoc)
Bonus: Leak and Overflow a PIE (heap-mayhem)
Bonus: A pwntools Primer
06: Processes and Threads
06: Processes and Threads
Demo: A Minimal Shell
Demo: Searching a File With Several Threads
01: Commands With Arguments
02: Builtin Commands
03: Adding Up What the Threads Found
04: Encrypting Files in Batches
Bonus: Background Processes
Bonus: Command Chaining
Bonus: The Last Batch Is Smaller
07: Parallelizing Execution
07: Parallelizing Execution
Demo: A Race Condition, and a Mutex
Demo: How Much Faster Do More Threads Make It?
01: A Parallel Substring Search
02: Parallel String Encryption
03: Hashing Files With Several Processes
04: Hashing Files With Several Threads
Bonus: A Synchronized In-Memory Database
08: Troubleshooting Concurrency
08: Troubleshooting Concurrency
Demo 01: A Linked List, and One Mutex
Demo 02: Three Threads That Take Turns
Demo 03: Three Eggs Make an Omelette
01: A Binary Search Tree for Eight Threads
02: Five Threads That Take Turns
03: A Name With Two Owners
04: Transfers That Never End
05: A Lock in the Wrong Place
06: Building H2O
07: A Queue That Loses Items
Bonus 01: A Boss and Its Workers
Bonus 02: A Pool of Worker Threads
Bonus 03: A Database Behind a Read-Write Lock
09: The I/O Interface. File I/O
10: Pipes and Redirection
11: Socket IPC
12: CTF
Full
Full
Lectures
Lectures
01: The Software Stack
01: The Software Stack
Demos
Demos
Pitch: Four Small Surprises
Pitch: Four Small Surprises
Demo: Two Ways to Build the Same String
Demo: char *str and char str[] Are Not the Same Declaration
Demo: The Same Command, Three Times, Fifteen Times Faster
Demo: Python Strings Are Immutable, Except When It Would Be Slow
Demo: Hello, World at Five Heights of the Stack
Demo: What a Security Guarantee Costs
Demo: A Web Application Is Four Programs Talking
Demo: A Web Application Is Four Programs Talking
Dockerized Wordpress with NGINX web server & MariaDB
Slides
02: Operating System Types and the OS Interface
02: Operating System Types and the OS Interface
Demos
Demos
Demo: The Kernel Does the Heavy Lifting
Demo: Building an Operating System
Demo: Building an Operating System
Demo: Build Hello, World with Unikraft
Demo: The System Call Interface
Demo: The System Call Interface
Demo: What a System Call Costs
Demo: Talking to the Kernel Directly
Demo: Privileged Instructions Fault in User Mode
Demo: Optimizing the OS Interface
Demo: Optimizing the OS Interface
Demo: Buffering in User Space
Demo: Moving Work into the Kernel with sendfile()
Slides
03: Memory Operations
03: Memory Operations
Demos
Demos
Demo: Why Care About Memory?
Demo: Why Care About Memory?
Demo: Memory You Do Not See Is Working for You
Demo: Where Data Sits Decides Speed
Demo: Memory You Forget to Free Is Gone
Demo: Memory Is What Runs Out
Demo: Memory Operations
Demo: Memory Operations
Demo: The Five Operations
Demo: Permissions Are Per Area
Demo: The Process Address Space
Demo: The Process Address Space
Demo: The Address Space, Line by Line
Demo: When Memory Is Allocated
Demo: When Memory Is Allocated
Demo: Where Every Kind of Variable Lives
Demo: Run-Time Allocation
Demo: Run-Time Allocation
Demo: Watching the Dynamic Areas Change
Demo: What malloc() Asks the Kernel For
Slides
04: Virtual Memory
04: Virtual Memory
Demos
Demos
Demo: Addresses Are Not Places
Demo: Addresses Are Not Places
Demo: Allocate 10 TB
Demo: A Browser With 1.5 TB of Memory
Demo: The Same Address, Twice
Demo: What We Already Know
Demo: What We Already Know
Demo: malloc() Under strace
Demo: Allocation Changes the List of Areas
Demo: Virtual Memory and Physical Memory
Demo: Virtual Memory and Physical Memory
Demo: Reserving Costs Nothing
Demo: Two Sizes for Every Process
Demo: Reserve, Allocate, Map
Demo: Reserve, Allocate, Map
Demo: One Fault per Page, Once
Demo: Touch Half, Pay for Half
Demo: Pages and the Page Table
Demo: Pages and the Page Table
Demo: Reading Your Own Page Table
Slides
05: Paging
05: Paging
Demos
Demos
Demo: Billions of Faults
Demo: Billions of Faults
Demo: Ten Billion Page Faults
Demo: More Resident Memory Than Memory
Demo: Two Views of One Address Space
Demo: Two Views of One Address Space
Demo: Which View Each Step Edits
Demo: One Address Space, Counted Both Ways
Demo: The Page Fault
Demo: The Page Fault
Demo: Minor and Major, on the Same File
Demo: Eight Accesses, Two Kinds of No
Demo: Where Frames Come From
Demo: Where Frames Come From
Demo: The Page Cache
Demo: Swap, in a Box
Demo: Memory Sharing
Demo: Memory Sharing
Demo: fork() and Copy-on-Write
Demo: RSS, PSS and USS for One Process
Demo: Ten Processes, Four Ways
Demo: Storing the Page Table
Demo: Storing the Page Table
Demo: How Much Page Table a Process Has
Demo: What a TLB Miss Costs
Slides
06: Processes and Threads
06: Processes and Threads
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: One Program on Many Cores
Demo: Processes and Threads in the System
Demo: Running an Application
Demo: Running an Application
Demo: Threads Share the Address Space
Demo: Threads
Demo: Threads
Demo: The Instruction Pointer and the Stack Pointer
Demo: A New Stack per Thread
Demo: Process Operations
Demo: Process Operations
Demo: An Orphan Process
Demo: Creating a Process with posix_spawn()
Demo: A Zombie Process
Demo: Thread Operations
Demo: Thread Operations
Demo: Create and Join
Demo: fork() and exec()
Demo: fork() and exec()
Demo: fork() and exec() by Hand
Demo: Tracing Process Creation
Slides
07: Scheduling
07: Scheduling
Demo: The Pitch
Demo: The Pitch
Demo: The Times of a Process
Demo: The Times of a Started Process
Demo: Threads Against CPUs
Demo: Processes, Recapped
Demo: Processes, Recapped
Demo: fork() and exec() by Hand
Demo: An Orphan Process
Demo: Creating a Process with posix_spawn()
Demo: A Zombie Process
Demo: Copy-on-Write
Demo: Copy-on-Write
Demo: The Page Faults of a Fork
Demo: Thread States
Demo: Thread States
Demo: A Thread Changing State
Demo: Showing Thread States
Demo: The Context Switch
Demo: The Context Switch
Demo: Context Switches and the Page Cache
Demo: Counting Context Switches
Demo: Queues, Waiting and Load
Demo: Queues, Waiting and Load
Demo: The Load Average
Demo: Time in the Ready Queue
Demo: Nuts and Bolts
Demo: Nuts and Bolts
Demo: The Nice Value
Slides
08: Concurrency
08: Concurrency
Demo: The Pitch
Demo: The Pitch
Demo: One Sum, Six Programs
Demo: Root Causes
Demo: Root Causes
Demo: One Core, Many Cores
Demo: Partitioning and Synchronization
Demo: Partitioning and Synchronization
Demo: Contention in the Kernel
Demo: A Shared List
Demo: Problems with Synchronization
Demo: Problems with Synchronization
Demo: A Deadlock
Demo: Granularity of a Critical Section
Demo: Time of Check to Time of Use
Slides
09: I/O Interface
09: I/O Interface
Demos
Demos
Demo: The Pitch
Demo: The Pitch
Demo: How Much I/O a Process Does
Demo: One Megabyte, Four Ways
Demo: Processes and the Outside World
Demo: Processes and the Outside World
Demo: List Open Files
Demo: The Process I/O Interface
Demo: The Process I/O Interface
Demo: I/O Operations on a FIFO
Demo: I/O Operations on a File
Demo: The File Descriptor Table
Demo: The File Descriptor Table
Demo: The Size of the File Descriptor Table
Demo: Which Entry a New Channel Gets
Demo: Types of I/O Channels
Demo: Types of I/O Channels
Demo: One Process, Every Kind of Channel
Demo: Five Ways from One Process to Another
Demo: File Channel Internals
Demo: File Channel Internals
Demo: Who Shares the File Pointer
Demo: Open Permissions
Demo: File Channel Operations
Demo: File Channel Operations
Demo: The File Pointer and the Size
Demo: Size Is Not Space
Slides
10: Inter-Process Communication
11: Network I/O
12: Inter-Application Interaction
Labs
Labs
01: The Software Stack
01: The Software Stack
Demo: Copy String
Demo: printf vs write
01: Implement strlen(), strcpy(), strcat(), memcpy()
02: XOR Encryption — Build and Use a Library
03: Stream Ciphers — Four Ways to Link the Same Program
Bonus: Stream Ciphers — One Executable per Cipher
Bonus: Make Your Own Library — Static vs Dynamic Linking
02: The Operating System Interface
02: The Operating System Interface
Demo: The write System Call
01: The getpid System Call
02: The nanosleep System Call
Bonus: clock_gettime and time
Bonus: Plugging _putchar() Into a Custom printf
03: Memory Operations
03: Memory Operations
Demo: Copy a File Using a Global Buffer
Demo: Copy a File Using a Local Buffer
Demo: Copy a File Using a Heap Buffer
Demo: Copy a File Using an mmap Buffer
01: XOR-Encrypt a File With a Fixed Key
02: Sort Products by Price
03: A Growable In-Memory Database
04: Reverse the Lines of a File
Bonus: A Shrinking In-Memory Database
Bonus: Tune malloc() for a Frame Pipeline
04: Memory Debugging
04: Memory Debugging
Demo: Debugging an In-Memory Database
Demo: Finding a Memory Leak With Valgrind
01: The Config Parser That Forgets
02: The Program That Is Right and Still Broken
03: The Histogram That Counts Too Much
04: The Report That Crashes in the C Library
Bonus: The JSON Parser With a Heap Buffer Overflow
Bonus: (Hard) No Source Code Allowed
Bonus: (Hard) The Symbol Table With Two Bugs
05: Memory Security
05: Memory Security
Demo: Flip the Lock (heap-0) — Solution
Demo: Set the Access Level (heap-1) — Solution
01: Overflow a Heap Buffer (heap-0) — Solution
02: Overflow to an Exact Value (heap-1) — Solution
03: Hijack a Function Pointer (heap-2) — Solution
04: Use-After-Free (heap-3) — Solution
Bonus: Cross Two Structs (heap-havoc) — Solution
Bonus: Leak and Overflow a PIE (heap-mayhem) — Solution
Bonus: A pwntools Primer — Full
06: Processes and Threads
06: Processes and Threads
Demo: A Minimal Shell
Demo: Searching a File With Several Threads
01: Commands With Arguments — Full
02: Builtin Commands — Full
03: Adding Up What the Threads Found
04: Encrypting Files in Batches
Bonus: Background Processes — Full
Bonus: Command Chaining — Full
Bonus: The Last Batch Is Smaller
07: Parallelizing Execution
07: Parallelizing Execution
Demo: A Race Condition, and a Mutex
Demo: How Much Faster Do More Threads Make It?
01: A Parallel Substring Search
02: Parallel String Encryption
03: Hashing Files With Several Processes
04: Hashing Files With Several Threads
Bonus: A Synchronized In-Memory Database
08: Troubleshooting Concurrency
08: Troubleshooting Concurrency
Demo 01: A Linked List, and One Mutex
Demo 02: Three Threads That Take Turns
Demo 03: Three Eggs Make an Omelette
01: A Binary Search Tree for Eight Threads
02: Five Threads That Take Turns
03: A Name With Two Owners
04: Transfers That Never End
05: A Lock in the Wrong Place
06: Building H2O
07: A Queue That Loses Items
Bonus 01: A Boss and Its Workers
Bonus 02: A Pool of Worker Threads
Bonus 03: A Database Behind a Read-Write Lock
09: The I/O Interface. File I/O
10: Pipes and Redirection
11: Socket IPC
12: CTF
Info
Info
How the Lab Works
Resources
Resources
QEMU Guide (MacOS)
UTM Guide (MacOS)
Rules and Grading (2026-2027)
Assignments
Assignments
Asynchronous Web Server
Asynchronous Web Server
Http Parser
ELF Loader Assignment
Lambda Function Loader
Local Procedure Call
Local Procedure Call
Client Manager Output Checker
Memory Allocator
Mini-libc
Minishell
Parallel Firewall
Parallel Graph
Bonus - SO Fair
Extra
Demo: Nuts and Bolts
¶
nice/
--- three groups of CPU hogs at nice -20, 0 and +19.
Back to top