# What the CMU 15-440 notes' code needs.
#
#   - Python >= 3.9, STANDARD LIBRARY ONLY. There are no pip packages to install.
#     The code is verified on Python 3.9 (macOS /usr/bin/python3) and 3.13, which
#     print byte-identical output for every simulated demo.
#
# Modules used: heapq, random, math, itertools, socket, threading, queue,
# multiprocessing, statistics, time, struct, json, pickle, copy, zlib, hashlib,
# hmac, subprocess, tempfile, shutil, builtins, os, stat, array, bisect,
# collections, signal, fcntl, select, ast, fnmatch, importlib -- all part of
# Python itself. (Lecture 15 uses random.randbytes, new in 3.9; Lecture 16's
# demo 05 and Lecture 17's demo 05 use SIGKILL, and the latter os.fork and
# select, so they need macOS or Linux.)
#
# Files on disk: Lectures 5-6 create a small temporary source tree (about 200 KB)
# with tempfile.mkdtemp and delete it afterwards; Lecture 9 reuses that trace.
# Lecture 6 allocates one 64 MB array for a real memory-access timing.
# Lecture 15 (demo 01 Part E) writes checkpoints of up to 64 MB, and Lecture 16
# (demo 05) rewrites a 1 MiB file, both in a temporary folder that is deleted
# afterwards. Lecture 17's RVM demos (05, 08) and Lecture 20's demo 05 write
# small files (a few MB at most) in temporary folders, also deleted afterwards.
# Lecture 22's demo 03 runs Lecture 5's mini Andrew benchmark in a temporary
# folder, deleted afterwards.
#
# Memory: Lecture 20's demo 04 model-checks 2.7 million Paxos states and needs
# about 400 MB for about a minute; everything else needs far less.
#
# Real measurements (labelled in their output, they vary from run to run):
# Lecture 8's ns-per-request column (demo 04 Part D), Lecture 9's socket-buffer
# test (loopback, ~15 s, paced reader), Lecture 12's RPC timing (Lecture 3's
# rpc.py over loopback), Lecture 15's checkpoint write times (fsync vs
# F_FULLFSYNC), Lecture 16's real-file experiments (torn reads, SIGKILL during
# an update, durable-update costs), Lecture 17's RVM commit costs, SIGKILL test
# and truncation timings (demo 05 Parts D-F), Lecture 20's acceptor-state
# write cost (demo 05 Part C), Lecture 23's SHA-256 mining times and hash
# rate (demo 01 Part B), Lecture 26's protect+verify microseconds (demo 01
# Part B) and its 2048-bit modular-exponentiation timings and the "x a MAC"
# ratios (demo 03 Part D). Everything else in Lectures 8-26 and the two
# supplements is simulated, enumerated or computed, and deterministic --
# including Lecture 24's MPI demos, whose ranks are real threads but whose
# messages are matched through FIFO queues, and Lecture 25's GFS, CRUSH and
# Chord demos on dsim.
#
# Lectures 25-26 and the supplements S1-S2 add no new requirements: Python 3.9+,
# standard library only. Lecture 25's Chord dynamics demo (06) runs about 20
# simulated networks and takes ~18 s; everything else there runs in a few
# seconds. Lecture 26's cryptography (toycrypto.py) is TEACHING ONLY -- seeded
# randomness, short exponents, not constant-time -- and must never be used for
# anything real; its demo 03 does real big-integer exponentiation (~4 s).
#
# Optional:
#   - clang (Xcode Command Line Tools on macOS, or LLVM on Linux). Lecture 3's
#     abi_layout.py uses `clang -target <triple> -ffreestanding -fsyntax-only` to
#     confirm struct layouts for seven ABIs. Without clang that column prints n/a.
#
# Networking note:
#   Demos that measure real communication costs open sockets ONLY on the loopback
#   interface 127.0.0.1 (port 0 = "any free port"). Nothing leaves your machine,
#   and every server thread/process exits by itself when the demo finishes.
#
# The course's own projects need other tools (not used here):
#   P1 is C on 64-bit Linux (gcc, make, LD_PRELOAD); P2-P4 are Java 8 (JDK, Java RMI).
