5 questions to test your understanding
A programmer writes a loop that iterates through a million-element array in order, processing each element once. Why does this run much faster than code that accesses the same million elements in random order?
A programmer wants critical data loaded into L1 cache to guarantee fast access. They look for an instruction to explicitly place a specific variable in L1 cache. Why won't they find one?
A cache miss means the requested data is lost and is expected to be recomputed or re-fetched from disk.
Registers are faster than L1 cache, and DRAM is slower than L3 cache but faster than secondary storage such as an SSD.
What are temporal locality and spatial locality, and why are they the reason the memory hierarchy works effectively rather than merely adding expensive storage layers?