Title: CSE 351 23au / LS17 Memory & Caches II

Q: The amount of bytes within each block is its ___ or `K`
A: block size

Q: True or false: Block size is always a power of 2
A: True

Q: Blocks consist of adjacent bytes, which differ in address by one. What kind of locality does this allow us to take advantage of? (Spatial/Temporal)
A: Spatial locality

Q: The amount of program data that the cache can store is the ___ or `C`
A: cache size

Q: True or false: Cache size is always a multiple of the block size
A: True

Q: Given cache size `C` and block size `K`, how do we find the number of blocks in the cache?
A: Cache Size / Block Size
C / K

Q: A cache size `C` is 32 KiB (2^15 bytes). The block size is 64 B (2^6 bytes).
How many blocks does our cache hold?
A: 32 KiB / 64 B =
     2^15 / 2^6 = 2^9 blocks

Q: How do we determine which block an address `A` is in?
A: Address / Block Size (A / K) gives us the Block Number
Note: This is integer division (regular division and then flooring the result)

Q: The position within the block where a byte of memory resides is called the ___
A: block offset

Q: How do we determine the block offset?
A ___ K
A: % (modulo)

Q: Within the cache, the number used to mark each slot for a block is known as the cache ___
A: index

Q: The width of the index field (s) is given by the lowest log_2(S) bytes of the _?_
[s = log_2(_?_)]
A: block number (K)

Q: After identifying the block number and offset, the remaining bits form the ___ field.
A: tag

Q: True or false: The tag field is unique across the different blocks that map into the same index.
A: True

Q: What does TIO in TIO address breakdown stand for?
A: Tag, Index, Offset

Q: Within a TIO address, which field is used to find where a block is located in a cache?
A: index field

Q: Within a TIO address, which field is used to check if the block found at the index is the one that was requested?
A: tag field

Q: Within a TIO address, which field is used to select and read the data to return to the CPU?
A: offset field

Q: The cache structure that assigns an index number to every “slot” that a block can go into is called a ___
A: direct-mapped cache

Q: True or false: In a direct-mapped cache, every block in memory does not always map to the exact same index every time.
A: False, based on the hash function (modding block number by number of indices), addresses will always map to the same index in the cache.

Q: What is the downside to a direct-mapped cache?
A: If we are repeatedly (one after the other) trying to access two addresses that map to the same index (but have different tags) we’d have a miss rate of 100% even if the rest of the cache indices are unused.