Title: CSE 351 23au / LS16 Memory & Caches I

Q: In the context of computers, a piece of memory that has short access time used to store frequently or recently used data is known as the  ___
A: cache ($)

Q: Why are caches important?
A: Caches provide a more efficient way to retrieve necessary data from memory
Context: memory performance has become a bottleneck in program performance due to the slower rate of transfer between memory and registers

Q: True or false: When we transfer data between caches and memory, we only transfer the exact bytes of data we need
A: False, data between caches and memory are transferred in blocks
Thinking about the avocado analogy, when we go to the store, we don’t just buy one avocado, we buy a bunch and bring them home and store them for later use

Q: We refer to blocks in the cache and memory by their ___
A: block number

Q: When accessing memory, where does the CPU check first?
A: The caches

Q: When the CPU finds the data its looking for in the cache, it’s known as a ___
A: cache hit

Q: When the CPU does not find the data its looking for in the cache, it’s known as a ___
A: cache miss

Q: After a cache miss, what is the next step?
A: The CPU will go to memory and bring back the block with the requested data, storing it in the cache

Q: In computer science, the principle stating that the way programs are written and languages are designed tend to use data and instructions at addresses equal to or near those that have been used recently is known as ___
A: principle of locality

Q: The principle stating that recently referenced items will likely be referenced again is known as ___
A: temporal locality

Q: Given a loop initialized with variable `int i` that is stored in memory, does `i` follow the principle of temporal or spatial locality?
A: Temporal locality! Each time we iterate through the loop, we keep updating `i`

Q: The principle stating that items with nearby addresses tend to be referenced close together in time is known as ___
A: spatial locality

Q: Given an array `a` that is stored in memory, does accessing elements of `a` follow the principle of temporal or spatial locality?
A: Spatial locality! Because arrays are contiguous chunks of memory, we’d be accessing data at addresses right next to each other

Q: With regard to cache performance metrics, what does the Hit Time (HT) measure?
A: The time to check the cache and return data to the CPU
This parameter is based on the cache hardware

Q: With regard to cache performance metrics, what does Miss Penalty (MP) measure?
A: The time it takes to fetch a block of data from memory
This parameter is based on cache and memory hardware

Q: The fraction of the code memory accesses that results in a cache hit is known as the ___
A: Hit Rate (HR)

Q: The fraction of the code memory accesses that results in a cache miss is known as the ___
A: Miss Rate (MR)

Q: Hit Rate + Miss Rate = ___
A: 100% by definition

Q: True or False: The Hit Rate and Miss Rate parameters are based on your code (software)
A: True

Q: What does AMAT stand for?
A: Average Memory Access Time

Q: Fill in the AMAT formula: ___ + ___ * ___
A: Hit Rate + Miss Rate * Miss Penalty
HR + MR * MP

Q: How are IEC prefixes different from SI prefixes?
A: SI prefixes are defined in base 10, whereas IEC prefixes help us specify very large powers of base 2 (1024 or 2^10)