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: January 8, 2024.

  • 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 (Monday 1/8): Welcome to CS111!
We'll go through course logistics, learning goals, and a tour of the quarter's topics.
Lecture 1 Slides
Handouts: Syllabus, Honor Code
Lecture Video
Out (Tues): assign0
Lecture 2 (Wed 1/10): 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 2 Slides
Lecture Video
OSPP, Chapter 11, Section 12.1, 12.2 and Section 13.3 (up through page 567)
No sections this week.
Lecture 3 (Fri 1/12): Unix V6 Filesystem
We'll dive deeper into the specifics of the Unix V6 filesystem, including more about inodes and supporting large files.
Lecture 3 Slides
Lecture Video
Lecture Quiz
Week 2
Mon 1/15 - No Lecture - MLK Day Out: assign1
In (Tues): assign0
Lecture 4 (Wed 1/17): 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 4 Slides
Lecture Video
Lecture Quiz
OSPP, Sections 13.1-13.2
Section 1: Filesystems
Lecture 5 (Fri 1/19): 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 5 Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 14 up through Section 14.1
Week 3
Lecture 6 (Mon 1/22): Crash Recovery + Filesystem System Calls
We'll talk more about the design challenges inherent in crash recovery and explore journaling/logging. We'll then turn to learning about how we can access the filesystem in our programs.
Lecture 6 Slides
Lecture 6 Code
Lecture Video
Lecture Quiz
Lecture 7 (Wed 1/24): More Filesystem system calls and file descriptors
We'll continue learning about how we can access the filesystem in our programs, and about how files are represented as file descriptors.
Lecture 7 Slides
Lecture 7 Code
Lecture Video
Lecture Quiz
Section 2: Crash Recovery
Lecture 8 (Fri 1/26): 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 8 Slides
Lecture 8 Code
Lecture Video
Lecture Quiz
OSPP, Chapter 4
In: assign1
Out: assign2
Week 4
Lecture 9 (Mon 1/29): 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 9 Slides
Lecture 9 Code
Lecture Video
Lecture Quiz
Lecture 10 (Wed 1/31): 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.
Lecture 10 Slides
Lecture 10 Code
Lecture Video
Lecture Quiz
In: assign2
Out assign3
Section 3: Processes
Lecture 11 (Fri 2/2): Pipes, Continued
We'll talk more about pipes, including I/O redirection and how they can enable feeding the output of one process as the input to another.
Lecture 11 Slides
Lecture 11 Code
Lecture Video
Lecture Quiz
Week 5
Lecture 12 (Mon 2/5): 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 12 Slides
Lecture 12 Code
Lecture Video
Lecture Quiz
OSPP, Chapter 4 and Chapter 5 up through Section 5.1
Lecture 13 (Wed 2/7): 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 13 Slides
Lecture 13 Code
Lecture Video
Lecture Quiz
OSPP, Sections 5.2-5.4 and Section 6.5
Section 4: Threads
Lecture 14 (Fri 2/9): Condition Variables
We'll introduce another synchronization primitive, condition variables, which allow threads to wait on certain conditions before proceeding.
Lecture 14 Slides
Lecture 14 Code
Lecture Video
Lecture Quiz
Week 6
Lecture 15 (Mon 2/12): Trust, Race Conditions and Multithreading Patterns
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. We'll also learn about the monitor pattern to help reason through writing multithreaded code.
Lecture 15 Slides
Lecture Video
Lecture Quiz
In (Sun): assign3
Lecture 16 (Wed 2/14): The Monitor Pattern
We'll work through an example of the monitor pattern, and preview assign4
Lecture 16 Slides
Lecture 16 Code
Lecture Video
Lecture Quiz
Out: assign4
(Thurs) Midterm Exam 7-9PM
No section this week.
Lecture 17 (Fri 2/16): Dispatching
We'll turn our attention to how the OS keeps track of threads and switches between them.
Lecture 17 Slides
Lecture 17 Code
Lecture Video
Lecture Quiz
Week 7
Mon 2/19 - No Lecture - Presidents' Day
Lecture 18 (Wed 2/21): 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 18 Slides
Lecture Video
Lecture Quiz
Section 5: Dispatching and Scheduling
Lecture 19 (Fri 2/23): 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 19 Slides
Lecture 19 Code
Lecture Video
Lecture Quiz
OSPP, Section 5.7
Week 8
Lecture 20 (Mon 2/26): 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 20 Slides
Lecture Video
Lecture Quiz
In: assign4
Out: assign5
Lecture 21 (Wed 2/28): 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 21 Slides
Lecture 21 Code
Lecture Video
Lecture Quiz
OSPP, Chapter 8
Section 6: Preemption and Virtual Memory
Lecture 22 (Fri 3/1): Dynamic Address Translation
We'll explore dynamic address translation, where the OS intercepts memory references and translates them dynamically, and discuss paging.
Lecture 22 Slides
Lecture Video
Lecture Quiz
Week 9
Lecture 23 (Mon 3/4): 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 23 Slides
Lecture Video
Lecture Quiz
Lecture 24 (Wed 3/6): 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 24 Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 9
In (Thurs): assign5
Out (Thurs): assign6
Section 7: Demand Paging
Lecture 25 (Fri 3/8): Modern Technologies and OSes
We'll talk about multicore processors and flash storage and how they impact the design of operating systems.
Lecture 25 Slides
Lecture Video
Lecture Quiz
Week 10
Lecture 26 (Mon 3/11): OSes and Trust, continued
We'll continue our discussion of trust and operating systems.
Lecture 26 Slides
Lecture Video
Lecture Quiz
Lecture 27 (Wed 3/13): 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 27 Slides
Lecture Video
Lecture Quiz
No sections this week.
Fri 3/15 - No Lecture - Rest Day In: assign6
Final Exam Week
Final Exam: Wed March 20, 3:30-6:30PM PDT