- Memory transfer time
- https://simple.wikipedia.org/wiki/Orders_of_magnitude_(time)
- Locality
- Temporal
- Spatial
- Your 2D loops will be better in C if you have the rows as the outer loop and columns as the inner loop. This is because of locality.
- Basic terms
- Cache misses
- Cold, capacity, conflict misses
- Cache hit
- Placement policies
- Replacement policies
- Victim block
- Working set
### Cache simulation project
- b bits
- Which byte of the block?
- Word offset
- Which word of the block?
- Byte offset
- Which byte of the word?
- Memory access in caching system
- Which block in VAS?
- Which word in block?
- Which byte in word?
- Block number
- s bits
- Which set does the block map to?
- t bits
- Which block in the set? (since multiple blocks can map to the same set)
- Acts as unique identifier
- When block is copied into cache, t bits are stored as tag
- Cache line
- Location in cache that can store one block of memory
- V bit
- If line in cache is used or not
- How does cache process request for word at particular address?
- Extract s bits, use it as an index
- Extract t bits and compare with tag for the line in set in cache
- If no match or valid bit = 0, cache miss
- If match and valid bit = 1, cache hit
- I kept thinking my instruction traces are in decimal and kept getting the wrong values. They were in hex. Stupid misunderstandings like this one cost engineers hours!