Memory timing: Difference between revisions
(→Cache) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
Note that if memory is not in main, it must be in virtual | Note that if memory is not in main, it must be in virtual | ||
= Cache = | |||
Fastest, ideally predict the future to put needed stuff into the cache using spatial and temporal locality. | |||
A cache is organized into S sets, each address mapping to exactly one set. | |||
* Direct mapped: 1 block per set | |||
* N-way set associative: N blocks per set | |||
* Fully associative: all cache blocks in 1 set | |||
The '''tag''' is used to detect misses. | |||
'''Compulsory misses''' cannot be prevented. '''Conflict misses''' happen when there is already another loaded thing in the cache blocking a new item. | |||
To implement spatial locality to reduce compulsory misses, increase the block size to multiple words and use a block offset to select between them. This way, surrounding words are loaded in. |
Latest revision as of 15:25, 5 June 2024
Keep recently accessed data in higher levels of memory hierarchy (i.e. use better memory).
Hit or miss
Hit is when data is found in that level of memory hierarchy. Miss is the complement.
Average memory access time
Note that if memory is not in main, it must be in virtual
Cache
Fastest, ideally predict the future to put needed stuff into the cache using spatial and temporal locality.
A cache is organized into S sets, each address mapping to exactly one set.
- Direct mapped: 1 block per set
- N-way set associative: N blocks per set
- Fully associative: all cache blocks in 1 set
The tag is used to detect misses.
Compulsory misses cannot be prevented. Conflict misses happen when there is already another loaded thing in the cache blocking a new item.
To implement spatial locality to reduce compulsory misses, increase the block size to multiple words and use a block offset to select between them. This way, surrounding words are loaded in.