Code used in class

This folder holds the code examples, demonstrations and simulators used in lectures and labs. Many come from the textbook’s ostep-code and ostep-homework repositories. Browse the files on GitHub.

Contents

Processes

CPU scheduling

Memory

Threads and concurrency

I/O and system calls

  • I/O examples: io.c
  • System call tracing: trace-io.*

Python simulators

Assembly

How to use

  1. Compilation: Most C programs can be compiled with gcc filename.c -o filename
  2. Python scripts: Run with python3 script.py
  3. Makefiles: Use make in directories that contain Makefiles
  4. Threading: Compile with -pthread flag for threading examples

Common headers

  • common.h: Shared definitions and includes
  • common_threads.h: Threading-specific includes

Subfolders

Subfolders from the textbook’s code: - intro/: Introduction examples - cpu-api/: Process API exercises - threads-intro/: Threading introduction - vm-intro/: Virtual memory introduction