CComputer Science, Built

Labs

One lab per part. Each is seeded, runs in seconds with nothing to download, checks its own result against the theory it illustrates, and ends with three things to change. They are written on Pebble and its tools: the computer the series builds from NAND gates, with its assembler, emulators, compilers, algorithms and systems models.

pip install numpy scipy matplotlib
python -m videos.cs.labs --list
python -m videos.cs.labs 1 --show
python -m pytest -q tests/test_courses.py -k cs
Lab 1 · What Is a Computation?Busy beavers by brute force, and what one tape costsLab 2 · Proof and CountingAn invariant against a search, and one fixed point on averageLab 3 · Logic from SwitchesOne gate is enough, and what two levels costLab 4 · ArithmeticCarries in a chain and in a tree; rounding error in a sumLab 5 · Memory and TimeA latch, a register file and every shift register of degree 2 to 8Lab 6 · The Stored-Program ComputerPrograms on Pebble: Euclid, a Turing machine, and the Job, version 0Lab 7 · PipelinesEvery bubble counted: a sort on the five-stage pipelineLab 8 · Out of OrderThe dataflow limit of a table scanLab 9 · The Memory HierarchyLoop order, stack distance and the scan that defeats LRULab 10 · Parallel MachinesBrent's theorem, two scans and a sorting networkLab 11 · The Running ProgramHoles in the heap, and 81 bytes on the stackLab 12 · Languages and AutomataA regex that doubles, and an automaton that does notLab 13 · The CompilerSSA interference graphs are chordal, until the copies come backLab 14 · Lambda and TypesChurch arithmetic, confluence and type safety, by machineLab 15 · RuntimesWhat a copying collector costs, and what a missing barrier losesLab 16 · Counting StepsCounting comparisons: the lower bound, and quicksort's averageLab 17 · Data StructuresProbes against load, and the depth of a random search treeLab 18 · GraphsExact routes with less search, and flows certified by cutsLab 19 · The Great ParadigmsThree products, n log n butterflies, and one problem four waysLab 20 · Randomness as a ResourceCoins against their boundsLab 21 · StringsFour matchers, one transform, one diffLab 22 · GeometryOne predicate, and the shadow of a hullLab 23 · OptimizationA certificate, an exponential walk, and three guaranteesLab 24 · Algorithms in PracticeWhat a range structure touchesLab 25 · UndecidableDominoes that compute: bounded search, a reduction, and PRIMEGAMELab 26 · P versus NPReductions that preserve the answer, and the 3-SAT thresholdLab 27 · Proofs and RandomnessSoundness, measured: sum-check and fingerprints against their boundsLab 28 · Error-Correcting CodesHamming(7,4) against its exact curve, and Reed-Solomon's 2e + f ruleLab 29 · SecretsAES from scratch: the standard's vector, the avalanche, ECB, and the birthday boundLab 30 · Public KeysEasy forwards, a square root backwards: Diffie-Hellman, RSA and their generic attacksLab 31 · The KernelThe convoy, and why a busy server is slowLab 32 · Virtual MemoryWhich page to evict: Belady's anomaly and the stack propertyLab 33 · ConcurrencyEvery schedule of a race, and a lock that the store buffer breaksLab 34 · StorageCrash at every write, and what spare flash buysLab 35 · DatabasesJoins by the page, and which interleavings are safeLab 36 · Networks I: Moving BitsALOHA's 1/2e and the count to infinityLab 37 · Networks II: Reliable ConversationOnly AIMD is fair, and TCP is an optimizerLab 38 · Distributed Systems I: AgreementRaft under attack: invariants, a planted bug, and split votesLab 39 · Distributed Systems II: ScaleQuorums that overlap, and the tail at scaleLab 40 · Software EngineeringWhat a change costs: Parnas's modules, Brooks' law, and estimatesLab 41 · Version Control, Builds and DependenciesThree machines, one idea: hashes, rebuilds and version solvingLab 42 · The Browser and the WebGreedy against total-fit line breaking, checked by brute forceLab 43 · APIs and ServicesAt most once, at least once, exactly onceLab 44 · People and ProductsPeeking, a sequential test, and CUPEDLab 45 · The CloudBin packing bounds, a delayed control loop, and the ninesLab 46 · Logs, Streams and WarehousesWatermarks, checkpoints and repetition levelsLab 47 · Search EnginesPostings merged, compressed and pruned; PageRank as an eigenvectorLab 48 · System Design I: Building BlocksThree blocks against their formulas: a cache, a rate limiter, an expiring keyLab 49 · System Design II: Case StudiesFour designs under test: fan-out, dispatch, dedup and double entryLab 50 · Keeping It RunningAvailability, a retry storm, and a sketch that keeps its promiseLab 51 · Light and PixelsSamples of light: noise, roulette and the white furnaceLab 52 · Computing with Real NumbersWhich answers to trust: backward error, pivoting, and two fast solversLab 53 · Quantum ComputationFive quantum claims, each checked on a state-vector simulatorLab 54 · Proving Programs CorrectFive midpoints, one solver, and every 8-bit inputLab 55 · Trusting TrustA trojan with no source, caught by a second compilerLab 56 · Spectral Graphs and ExpandersWhat the second eigenvalue promises: cuts, walks and expandersLab 57 · Learning TheoryBounds against measurements: PAC, VC, margins, regretLab 58 · SemanticsThree interpreters, one meaningLab 59 · Distributed Computing TheoryLocality, a liar and a lemmaLab 60 · Domain-Specific HardwareA matrix product as a waveLab 61 · Doing ResearchHow not to fool yourself with a stopwatch