Stanford Engineering Everywhere notes

CS107: Programming Paradigms

Study C, C++, memory, assembly, and concurrency through a focused set of notes, diagrams, examples, and a reproducible Docker environment.

18 lecture notes 9 buildable examples 23 handouts

Course map

A path from bytes to threads

The material moves from representation and pointers into generic data structures, low-level machine behavior, and finally concurrent programs.

Generic pointer diagram

Lec 01-04

Foundations

C memory layout, pointers, casts, and generic pointer techniques.

Stack and heap diagram

Lec 05-08

Data and Memory

Generic stacks, allocation strategies, stack frames, and heap behavior.

Lec 09-14

Machine Model

Assembly, activation records, preprocessing, compiling, and linking.

Ice cream store simulation diagram

Lec 15-18

Concurrency

Threads, semaphores, critical regions, and coordination patterns.

Local lab

Reproducible Docker setup

The repository includes a Linux-based environment for compiling examples, debugging with gdb, and checking memory behavior with valgrind.

Build and enter the lab
make docker-build
make docker-shell
Compile examples with CMake
make examples
./build/examples/generic-pointer/generic_swap
Debug-friendly shell
make docker-debug-shell
gdb ./build/examples/dinning