Principle of locality: Memory Hierarchies
Text and data are not accessed randomly
Temporal locality
- Recently accessed items will be accessed in the near future (e.g., code in loops, top of stack)
Spatial locality
- Items at addresses close to the addresses of recently accessed items will be accessed in the near future (elements of arrays)
Leads to memory hierarchy at two main interface levels:
- Processor - Main memory -> Introduction of caches
- Main memory - Secondary memory -> Virtual memory (paging systems)