Skip to main content

Module 2: Memory Management & Virtual Memory: Mistake Clinic

This clinic turns wrong moves into reusable judgment. Use it after each practice page and again before the quiz or checkpoint.


Module-Specific Mistake Radar

Start with these traps. Replace or extend them with real mistakes from your own work.

Mistake to look forWhere it shows upSymptomRepair evidence
Finishing Page Fault and TLB Measurement Lab with only a final answerPage Fault and TLB Measurement LabThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Page Replacement Simulator Workshop with only a final answerPage Replacement Simulator WorkshopThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Allocator Comparison Clinic with only a final answerAllocator Comparison ClinicThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Finishing Code Katas with only a final answerCode KatasThe work has no failed case, trace, test, proof gap, or design stress point.Add the smallest broken example and show the repair that changes the result.
Treating Physical vs Virtual Addresses: Why We Need Translation as vocabulary instead of a toolPhysical vs Virtual Addresses: Why We Need TranslationThe explanation names the concept but cannot decide between two cases.Write one example, one non-example, and the rule that separates them.
Treating Base/Bounds and Segmentation: The First Answer as vocabulary instead of a toolBase/Bounds and Segmentation: The First AnswerThe explanation names the concept but cannot decide between two cases.Write one example, one non-example, and the rule that separates them.

Practice Mistake Checks

Pull any miss from these checks into your mistake log.

Page Fault and TLB Measurement Lab

Source: practice/01-page-fault-and-tlb-measurement-lab.md

Identify the error in each statement:

  1. "The program is slow because of page faults." (when perf stat shows 20 faults total)
  2. "Linux does not use LRU so I do not need to worry about replacement policies."
  3. "A huge page eliminates TLB misses."
  4. "perf stat shows 1 billion TLB loads, so the program has 1 billion TLB misses."
  5. "Adding RAM to the machine always reduces minor-fault count."

Page Replacement Simulator Workshop

Source: practice/02-page-replacement-simulator-workshop.md

Identify the error:

  1. "OPT is the policy with the lowest fault rate, so we should use it in production."
  2. "FIFO never outperforms LRU."
  3. "Adding more frames always reduces fault count."
  4. "The working set and the resident set size are the same."
  5. "A policy with a lower miss rate is always better, regardless of implementation cost."

Allocator Comparison Clinic

Source: practice/03-allocator-comparison-clinic.md

Identify the error:

  1. "I called free, so the RSS should drop immediately."
  2. "glibc malloc is slow because it is old; newer allocators will always be faster."
  3. "Switching allocators is risky because it changes program behavior."
  4. "Valgrind says no leaks, so the growing RSS is not caused by allocations."
  5. "The allocator only matters for multithreaded programs."

Repair Protocol

For each real mistake:

  1. Reproduce the failure on the smallest example, trace, proof, query, command, or design sketch.
  2. Name the hidden assumption.
  3. Repair the artifact.
  4. Save evidence that changed: failing then passing test, corrected proof step, revised diagram, safer command, benchmark, or review note.
  5. Add one retrieval card beginning with Check... before... or Do not use... when....

Mistake Log

DateMistakeSymptomRoot causeRepair evidenceRetrieval card
StarterPick one radar row aboveExplain how it would fail in this moduleName the assumptionAdd a counterexample or corrected artifactWrite the card before closing the page

Completion Standard

  • At least five real mistakes are logged.
  • At least two mistakes include a counterexample or failing test.
  • At least one mistake connects to an older semester skill.
  • At least one correction changes code, a proof, a diagram, a command transcript, a query, or a design decision.