Cache Flashcards
Temporal locality
data accessed will likely be accessed again soon, so save the data in a small storage that is fast. AKA cache
Spatial locality
more likely to access data close to each other, so we fetch memory in blocks not just one entry at a time.
Locality
programs tend to accessed data and instructions with address near or the same as data recently used.
Describe a cache organization
sets, blocks, valid bit, tag, data itself
Fully associated cache
each set only has one block
2-way associated cache / n-way association
each set has two blocks or n blocks
How to map address in a branch instruction to memory location
the address bits is split into offset, index, tag bits.
Index bits specifies which ‘set’, tag bits specify is data matches, offset is to access the right bit in a block.
Cache miss
when the tag bits doesn’t match the tag in a set
How does the offset, index and tag bits of an address change for n-way associative cache
n-way associative means. n blocks per set. so number of sets can be reduced by n times. so index bits can be reduced. giving more bits for tag matching. since there’s n times more tags now