GOAT EngineerPreparing your learning space…

System Design · Interactive workshop

The cache locality workbench

Build it. Run it. Follow the bytes.

A cache fetches a whole line of nearby bytes. Reading those bytes before their line is evicted reuses that transfer. Compare the same 16 addresses in sequential and column order to see how access order changes cache misses and fetched bytes.

The canvas runs in your browser and needs JavaScript. You can read the model below and read the accompanying Library lesson without JavaScript.

What this machine models

Model cache-lines-lru-1 has 64 immutable RAM bytes; address a contains a + 1. Configure 1 to 128 reads, 2/4/8 bytes per line and 1 to 8 cache slots. The cache starts cold, is fully associative, and evicts the least recently used line. Every hit and fill updates recency.

Each read is blocking: a hit costs 1 teaching tick and a miss costs 10 total, including lookup and fill. Every miss fetches one whole line. The accumulator adds the read values. These are declared teaching costs, not measured clock cycles or hardware latency.

No stores, prefetch, multiple cache levels, set conflicts, coherence, TLB, paging, memory-level parallelism or disk reads are modeled. Invalid addresses and exhausted input bounds refuse the entire run. Compare full workloads as well as checksums before claiming equal work.

The traversal generator visits every address once per pass, grouped by remainder under the stride. Step and playback expose recorded reads. One pinned comparison and article detours use temporary browser memory. Reload clears them. No grade or assessment is saved.

By GOAT Engineer. Explore System Design · Privacy Policy · Contact.