Calendar

NOTE: this website is out of date. This is the course web site from a past quarter. If you are a current student taking the course, you should visit the current class web site instead. If the current website is not yet visible by going to cs111.stanford.edu, it may be accessible by visiting this link until the new page is mounted at this address. Please be advised that courses' policies change with each new quarter and instructor, and any information on this out-of-date page may not apply to you.

Below is a preview of the week-by-week plan for the quarter. There may be adjustments and rearrangements as we go.

Last updated: March 09, 2025.

  • Lecture videos are posted on Canvas under the "Panopto Course Videos" tab.

  • In the readings listed below, OSPP is Operating Systems: Principles and Practice by Thomas Anderson and Michael Dahlin. These readings are optional.

Lecture Code

Any code examples worked in class will be posted into /afs/ir/class/cs111/lecture-code/lect[N] where you replace [N] with the lecture number. You can make a copy to compile or modify by doing the following, which will make a folder in the current location called lect[N] that is a copy of the lect[N] code.

cp -r /afs/ir/class/cs111/lecture-code/lect[N] lect[N]

You can also view lecture code from your web browser by clicking here.

Topics Resources Assignments
Week 1
Lecture 1 (Mon 1/6): Welcome to CS111!
We'll go through course logistics, learning goals, and a tour of the quarter's topics.
Lecture Slides
Lecture Video
Handouts: Syllabus, Honor Code
Out: assign0
Lecture 2 (Wed 1/8): Intro to Filesystems
Topic 1: How can we design filesystems to manage files on disk, and how can we interact with the filesystem in our programs?
We'll learn about the responsibilities of a filesystem and the core challenges in designing them. We'll discuss various filesystem designs, including the Unix v6 filesystem, which we'll explore more in depth in subsequent lectures.
Lecture Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 11, Section 12.1, 12.2 and Section 13.3 (up through page 567)
No section this week.
Lecture 3 (Fri 1/10): Unix V6 Filesystem
We'll dive deeper into the specifics of the Unix V6 filesystem, including more about inodes and supporting large files.
Lecture Slides
Lecture Video
Lecture Quiz
Out: assign1
Week 2
Lecture 4 (Mon 1/13): Unix V6 Filesystem, Continued
We'll learn about how the Unix V6 filesystem represents directories, the process for file lookup, and explore other possible filesystem designs.
Lecture Slides
Lecture Video
Lecture Quiz
OSPP, Sections 13.1-13.2
In: assign0
Lecture 5 (Wed 1/15): Crash Recovery
We'll explore mechanisms for filesystems to recover in the event of a crash, and the design challenges inherent in crash recovery.
Lecture Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 14 up through Section 14.1
Section 1: Filesystems
Lecture 6 (Fri 1/17): Crash Recovery, Continued
We'll talk more about the design challenges inherent in crash recovery and explore journaling/logging.
Lecture Slides
Lecture Video
Lecture Quiz
Week 3
Mon 1/20 - No Lecture - MLK Day
Lecture 7 (Wed 1/22): Filesystem system calls and file descriptors
We'll learn about how we can access the filesystem in our programs, and about how files are represented as file descriptors.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
Out: assign2
Section 2: Crash Recovery
Lecture 8 (Fri 1/24): Processes Introduction
Topic 2: How can our program create and interact with other programs? How does the operating system manage user programs?
We'll learn about what a process is, how the operating system manages them, and we'll practice using the fork system call to create new processes.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
OSPP, Chapter 4
In: assign1
Week 4
Lecture 9 (Mon 1/27): Multiprocessing System Calls
We'll dive deeper into the fork system call and introduce waitpid to wait on a child process and execvp to run a different program within a process.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
Lecture 10 (Wed 1/29): Interprocess Communication with Pipes
We'll introduce the pipe system call, which gives us a way for processes to send and receive data between one another, and the dup2 system call for duplicating file descriptors.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
In: assign2
Out: assign3
Section 3: Processes
Lecture 11 (Fri 1/31): Pipes, Continued
We'll talk more about how pipes can enable feeding the output of one process as the input to another, and why pipes can be shared across a call to fork.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
Week 5
Lecture 12 (Mon 2/3): Threads Introduction
Topic 3: How can we have concurrency within a single process? How does the operating system support this?
We'll learn about what a thread is, how the operating system manages them, and we'll learn about the challenges in writing multithreaded programs.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
OSPP, Chapter 4 and Chapter 5 up through Section 5.1
Lecture 13 (Wed 2/5): Race Conditions and Locks
We'll learn more about the core challenge of multithreaded programs: race conditions. We'll see how locks ("mutexes") can help address them.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
OSPP, Sections 5.2-5.4 and Section 6.5
Section 4: Threads
Lecture 14 (Fri 2/7): Condition Variables
We'll introduce another synchronization primitive, condition variables, which allow threads to wait on certain conditions before proceeding.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
Week 6
Lecture 15 (Mon 2/10): The Monitor Pattern
We'll learn about the monitor pattern to help reason through writing multithreaded code, and work through an example. We'll also preview assign4.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
In (Sun): assign3
Out: assign4
Lecture 16 (Wed 2/12): Trust and Race Conditions
We'll step back to reflect on the challenges of multithreaded code, discuss how we trust software such as operating systems, and the challenges that come with trust and when it is violated.
Lecture Slides
Lecture Video
Lecture Quiz
(Thurs) Midterm Exam 7-9PM
No section this week.
Lecture 17 (Fri 2/14): Dispatching
We'll turn our attention to how the OS keeps track of threads and switches between them.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
Week 7
Mon 2/17 - No Lecture - Presidents' Day
Lecture 18 (Wed 2/19): Scheduling
We'll explore tradeoffs in scheduling: deciding which thread gets to run next and for how long. We'll overview 4 approaches to scheduling.
Lecture Slides
Lecture Video
Lecture Quiz
Section 5: Dispatching and Scheduling
Lecture 19 (Fri 2/21): Preemption and Implementing Locks
We'll turn our attention to how to implement the round-robin scheduling pattern. We'll also start discussing how to implement locks.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
OSPP, Section 5.7
Week 8
Lecture 20 (Mon 2/24): Implementing Locks and CVs
We'll finish exploring how to implement locks on single-core systems, and give some tips on implementing condition variables. Then we'll overview assign5.
Lecture Slides
Lecture Video
Lecture Quiz
In: assign4
Out: assign5
Lecture 21 (Wed 2/26): Virtual Memory Introduction
Topic 4: How can one set of memory be shared among several processes? How can the operating system manage access to a limited amount of system memory?
We'll introduce the concept of virtual memory, where the operating system hides real memory addresses from programs. This explains how multiple programs can all think they can use the same memory address at the same time.
Lecture Slides
Lecture Code
Lecture Video
Lecture Quiz
OSPP, Chapter 8
Section 6: Preemption and Virtual Memory
Lecture 22 (Fri 2/28): Dynamic Address Translation
We'll explore dynamic address translation, where the OS intercepts memory references and translates them dynamically, and discuss paging.
Lecture Slides
Lecture Video
Lecture Quiz
Week 9
Lecture 23 (Mon 3/3): Demand Paging
We'll build on our discussion of paging and learn about how we can kick pages to disk when we need more space, effectively making physical memory appear larger than it really is.
Lecture Slides
Lecture Video
Lecture Quiz
Lecture 24 (Wed 3/5): The Clock Algorithm
We'll discuss the clock algorithm for deciding which pages to kick from memory when we run out of space, and wrap up our discussion of virtual memory.
Lecture Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 9
In (Thurs): assign5
Out (Thurs): assign6
Section 7: Demand Paging
Lecture 25 (Fri 3/7): Modern Technologies and OSes
We'll talk about multicore processors and flash storage and how they impact the design of operating systems.
Lecture Slides
Lecture Video
Lecture Quiz
Week 10
Lecture 26 (Mon 3/10): OSes and Trust, Continued
We'll continue our discussion of trust and operating systems.
Lecture Slides
Lecture Video
Lecture Quiz
Lecture 27 (Wed 3/12): Wrap-up and Q&A
We'll wrap up the course themes, preview courses and opportunities post-111, and say some final words. Bring questions if you have them!
Lecture Slides
Lecture Video
Lecture Quiz
No sections this week.
Fri 3/14 - No Lecture - Rest Day In: assign6
Final Exam Week
Final Exam: Friday, March 21, 8:30AM-11:30AM PDT