Cache Management and Designs Flashcards
Temporal locality
Programs exhibit temporal locality, if an item in memory is referenced, it is likely to be referenced again soon
Spatial locality
Programs exhibit spatial locality, if an item in memory is referenced, then it is likely that those nearby will be referenced soon. When a specific memory block is referenced, the cache will also bring in additional memory blocks located at similar addresses
Cache hit/Miss
When memory is requested from the cache it can either result in a hit or a miss
Hit - the requested data is in cache and can be read
Miss - the data is read from memory into cache first
Direct-mapped cache + pros and cons
A memory address is mapped to exactly one cache address
Pros:
Easy to search
Cons:
Inefficient use of cache space
Fully associative cache + pros and cons
A memory address is mapped to the least recently used cache address
Pros:
Flexible, allows the cache to be filled with any combination of memory addresses
Cons:
takes a long time to search
Write hit - write back
Write into cache memory only, means faster writes but need to remember to later write to memory before replacing modified cache data
Write hit - write through
Write to both cache and memory, slower but means that cache and memory are in sync
Write miss - write around (no write allocate)
Write into memory only, avoids unnecessary cache access and pollution but does not utilise temporal locality
Write miss - write allocate
Write into memory and read into cache - exploits temporal locality but can mean there’s unnecessary cache access and pollution