Calendar

NOTE: this website is out of date. This is the course web site from a past quarter, Fall 2023. 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: September 26, 2023.

  • 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
Mon 9/25 - No Lecture - YOM KIPPUR
Lecture 1 (Wed 9/27): 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: assign0
No sections this week.
Lecture 2 (Fri 9/29): 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)
Week 2
Lecture 3 (Mon 10/2): 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
In: assign0
Out: assign1
Lecture 4 (Wed 10/4): 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 10/6): Filesystem system calls and file descriptors
We'll turn to learning about how we can access the filesystem in our programs, and how files are represented as file descriptors.
Lecture 5 Slides
Lecture 5 Code
Lecture Video
Week 3
Lecture 6 (Mon 10/9): 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 6 Slides
Lecture Video
Lecture Quiz
OSPP, Chapter 14 up through Section 14.1
Lecture 7 (Wed 10/11): Crash Recovery, Continued
We'll talk more about the design challenges inherent in crash recovery and explore mechanisms for crash recovery, including journaling.
Lecture 7 Slides
Lecture Video
Lecture Quiz
In (Thurs): assign1
Out (Thurs): assign2
Section 2: Crash Recovery
Lecture 8 (Fri 10/13): 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
OSPP, Chapter 4
Lecture Video
Lecture Quiz
Week 4
Lecture 9 (Mon 10/16): 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 10/18): 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 10/20): 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 10/23): 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 10/25): 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 10/27): 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 10/30): Multithreading Patterns
We'll recap our discussion of condition variables, we'll learn about the monitor pattern for writing multithreaded code, and wrap up our discussion of multithreading.
Lecture 15 Slides
Lecture 15 Code
Lecture Video
Lecture Quiz
In (Sun): assign3
Wed 11/1 - No Lecture - Rest Day Midterm Exam 7-9PM
No section this week.
Lecture 16 (Fri 11/3): Operating Systems and Trust + assign4
We'll talk about trust in software such as operating systems and the challenges that come with trust and when it is violated. We'll also overview assign4.
Lecture 16 Slides
Lecture 16 Code
Lecture Video
Lecture Quiz
Out: assign4
Week 7
Lecture 17 (Mon 11/6): 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
Lecture 18 (Wed 11/8): 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 11/10): 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 11/13): 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 (Tues): assign5
Lecture 21 (Wed 11/15): 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 11/17): 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
Holiday: Thanksgiving (11/20 - 11/24)
Week 9
Lecture 23 (Mon 11/27): 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 11/29): 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 12/1): OS Trust in Context
We'll continue our discussion of trust and operating systems.
Lecture 25 Slides
Lecture Video
Lecture Quiz
Week 10
Lecture 26 (Mon 12/4): Modern Technologies and OSes
We'll talk about multicore processors and flash storage and how they impact the design of operating systems.
Lecture 26 Slides
Lecture Video
Lecture Quiz
Lecture 27 (Wed 12/6): 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 12/8 - No Lecture - Rest Day In: assign6
Final Exam Week
Final Exam: Fri December 15, 8:30AM-11:30AM