Below is a preview of the week-by-week plan for the quarter. There may be adjustments and rearrangements as we go.
Last updated: July 10, 2026.
Lecture videos are posted on Canvas under the "Panopto Course Videos" tab.
In the readings listed below, B&O is Computer Systems (Bryant and O'Hallaron), K&R is The C Programming Language (Kernighan and Ritchie) accessible here (requires free Open Library account to borrow), and Essential C is a PDF available at http://cslibrary.stanford.edu/101. B&O scanned PDFs for the listed readings are available on Canvas under the "Files" tab.
Lecture Code
Any code examples worked in class will be posted into /afs/ir/class/cs107/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/cs107/lecture-code/lect[N] lect[N]
You can also view lecture code from your web browser by clicking here.
NOTE: Please keep in mind lecture topics are expected dates, the actual date may be a bit later/earlier, all topics will be covered before the final.
| Topics | Resources | Assignments |
|---|---|---|
| Week 1 | ||
|
Lecture 1 (Mon 6/22): Welcome to CS107!
We'll go through course logistics, learning goals, and a tour of Unix and the command line. |
Lecture Slides
Handouts: Syllabus, Honor Code B&O Ch 1 - skim this chapter for a quick overview of what is meant by systems, and for a preview of topics to come. |
Out: assign0 |
|
Lecture 2 (Wed 6/24): Unix and C
We'll get started with the command line and introduce the C programming language. |
Lecture Slides
|
|
|
Lecture 3 (Fri 6/26): Integers, Bits and Bytes
Topic 1: How can a computer represent integer numbers? We'll learn about the representation of the integer types: char, short, int, and long, in both unsigned and two's complement signed. We'll discuss binary, hexadecimal, integer arithmetic and overflow.
|
Lecture Slides
B&O Ch 2.2-2.3 - skim the formal proofs, but it's important to take away a solid working knowledge of two's complement and behaviors of integer operations. |
In: assign0 Out: assign1 |
| Week 2 | ||
|
Lecture 4 (Mon 6/29): Chars and C-Strings
Topic 2: How can a computer represent and manipulate more complex data like text? We'll explore how strings and characters are manipulated in C using the char and char * types, discuss null termination, and become familiar with the string.h functions.
|
Lecture Slides
B&O Ch 2.1 |
|
|
Lecture 5 (Wed 7/1): C-Strings, Pointers, and Arrays
We'll review a little bit of what we went over on Monday! Then we'll dig deeper into C strings and learn more about how C strings are examples of arrays and pointers. |
Lecture Slides
K&R Ch 1.6, 5.5 or Essential C section 3 on the mechanics of pointers and arrays. Pay special attention to the relationship between arrays and pointers and how pointers/arrays are passed as parameters. |
Lab 2: C-Strings Be sure to check out our guide to Valgrind. |
| Fri 7/3 - No Lecture - 4th of July! |
In: assign1 Out: assign2 |
|
| Week 3 | ||
|
Lecture 6 (Mon 7/6): Pointers and Arrays
Topic 3: How can we effectively manage all types of memory in our programs? We'll answer questions like: how are pointers useful in programs? How are arrays and pointers the same? How are they different? How is an array/pointer passed/returned in a function call? |
Lecture Slides
K&R 5.2-5.5 or Essential C section 6 on advanced pointers |
|
|
Lecture 7 (Wed 7/8): Stack and Heap
We'll introduce dynamic allocation on the heap with malloc and free and compare the stack and the heap.
|
Lecture Slides
K&R 5.6-5.9 or Essential C section 6 on the heap. The key concept is comparing and contrasting stack and heap allocation. |
|
Lecture 8 (Fri 7/10): Generic Operations: void *
Topic 4: How can we use our knowledge of memory and data representation to write code that works with any data type? We'll introduce untyped void * pointers and motivate C generics. We'll also discuss vulnerability disclosure, use-after-free bugs and partiality.
|
Lecture Slides
K&R 5.11, review man pages or your C reference to be introduced to generic functions in the C library ( qsort, lfind, bsearch)
|
In: assign2 Out: assign3 |
| Week 4 | ||
|
Lecture 9 (Mon 7/13): Function Pointers
We'll continue discussing generics and introduce function pointers, which allow us to pass functions as parameters and store them in variables. |
K&R 5.11, review man pages or your C reference to be introduced to generic functions in the C library (qsort, lfind, bsearch)
|
|
|
Lecture 10 (Wed 7/15): Midterm
None |
||
|
Lecture 11 (Fri 7/17): Intro to Assembly
Topic 5: How does a computer interpret and execute C programs? We'll introduce assembly/machine language and find out what's happening underneath the hood of the C compiler, including a discussion of the x86-64 instruction set architecture and its powerful mov instruction, along with addressing modes, data layout, and access to variables of various types. |
In: assign3 Out: assign4 |
|
| Week 5 | ||
|
Lecture 12 (Mon 7/20): None
None |
||
|
Lecture 13 (Wed 7/22): Arithmetic & Logic Operations
We'll be talking about arithmetic and logical instructions and do practice reverse engineering examples. |
||
|
Lecture 14 (Fri 7/24): x86-64 Condition Codes and Control Flow
We'll see how to implement C if/else in assembly.
|
B&O 3.5-3.6 Be sure to check out our x86-64 guide. |
(Tues) Midterm Exam 7-9PM |
| Week 6 | ||
|
Lecture 15 (Mon 7/27): x86-64 Runtime Stack
We'll talk about procedures and the runtime stack along with instructions for call/return, parameter passing, local stack storage, and register use. |
||
|
Lecture 16 (Wed 7/29): Alignment, Optimization, & Basic Architecture
We'll have larger discussions of privacy and trust, and then find out what's happening underneath the hood of the C compiler |
||
|
Lecture 17 (Fri 7/31): Managing the Heap
Topic 6: How do core memory-allocation operations like malloc and free work?We'll have larger discussions of privacy and trust, and then move on to our final main topic. We'll see how the heap fits into the address space and introduce design decisions for implementing malloc/realloc/free, as well as performance tradeoffs (throughput, utilization).
|
B&O Ch. 9.9 and 9.11 cover heap allocation implementation and memory misuses. There's lots of very useful detail in 9.9 for your heap allocator! |
In: assign4 Out: assign5 |
| Week 7 | ||
|
Lecture 18 (Mon 8/3): Managing the Heap, Continued
We'll explore the implicit free list allocator, and the explicit free list allocator, and compare them and discuss performance tradeoffs (throughput, utilization). We'll learn more about other techniques employed by allocators including coalescing and in-place realloc. |
Optimally skim B&O Ch. 5 | |
| Final Exam Week | ||
| Final Exam: Friday, August 14, 3:30PM - 6:30PM PST |