Exploiting Memory Hierarchy Chapter 7 B Ramamurthy Page
Exploiting Memory Hierarchy Chapter 7 B. Ramamurthy Page 1 1/9/2022
Introduction • Memory refers to storage needed by the kernel, the other components of the operating system and the user programs. • In a multi-processing, multi-user system, the structure of the memory is quite complex. • Efficient memory management is very critical for good performance of the entire system. • In this discussion we will study the important role the levels of cache memory play in the processor performance. Page 2 1/9/2022
Locality • Temporal locality: Addresses that are referenced at some time Ts will be accessed in the near future (Ts + delta_time) with high probability. Example : Execution in a loop. • Spatial locality: Items whose addresses are near one another tend to be referenced close together in time. Example: Accessing array elements. • How can we exploit this characteristics of programs? Keep only the current locality in the main memory. Need not keep the entire program in the main memory. Page 3 1/9/2022
Memory Hierarchy CPU Registers CPU on-chip cache level 1 CPU on-chip cache level 2 CPU off-chip cache Main memory – on board System level – off board Secondary memory – on disk Page 4 1/9/2022
Direct-mapped Cache • See fig. 7. 5, 7. 6, 7. 7 • Content addressable memory Page 5 1/9/2022
Direct Mapped Cache: the Idea Cache Main Memory All addresses with LSB 001 will map to purple cache slot All addresses with LSB 101 will map to blue cache slot And so on Page 6 1/9/2022
Cache Organization • Content addressable memory • Fully associative • Set associative Fig. 7. 7 Regular Memory Organization Page 7 Cache Memory Organization Address Data 1/9/2022
Cache organization Fig. 7. 7 • Valid bit, tag, index, circuitry for comparison of tags. 20 bits tag Page 8 10 bits index 2 bit Byte of the word selection 1/9/2022
- Slides: 8