Memory and Cache Flashcards
What is Fully Associative Cache?
Fully Associative Cache can map a memory address to any block in the cache
What is Set Associative Cache?
Trade-off between direct mapped cache and the fully associative cache, divided into groups of blocks called sets, where each memory address is mapped to only one set (data can be placed anywhere within this set)
How does a Set Associative Cache differ from both Direct Mapped and Fully Associative Caches?
Set associative divides cache into sets, each address maps to one set but can be placed in any block within that set, balancing flexibility and efficiency
What are the trade-offs of using a Fully Associative Cache compared to Direct Mapping?
Fully associative allows any data to be stored anywhere, increasing flexibility at the cost of complexity and higher hardware requirements
What is temporal locality, and how does it influence what should be stored in the cache?
Temporal locality suggests that recently accessed data will likely be accessed again soon, such data should be kept in a cache
What is direct mapping in cache architecture?
A method where each memory location maps to exactly one location in the cache
Define the principle of locality in relation to cache performance
- The tendency of a program to access a relatively small portion of its address space at any given time
- Typically temporal and spatial locality
What is the difference in access times and costs between Dynamic RAM (DRAM) and Flash superconductor memory?
DRAM access time: 50ns to 70ns; Cost: $10 to $20 per GB; Flash access time: 5,000ns to 50,000ns; Cost: $0.75 to $1 per GB
Explain how invalid blocks in a cache can be reused for new data
Invalid blocks can be filled with new data without affecting existing valid data, making efficient use of cache space
In what scenarios are larger block sizes beneficial for cache performance?
When accessing contiguous data items, larger blocks can exploit spatial locality, reducing the number of cache misses
What impact does miss penalty have on Average Memory Access Time (AMAT)?
Higher miss penalty increases AMAT, leading to slower overall performance as more time is spent fetching data from memory
What are the components that make up Average Memory Access Time (AMAT)? (Formula)
AMAT = hit time + (miss rate × miss penalty)
How do you place a new value in a cache?
Mapping techniques such as:
- Direct mapping
- Fully associative
- Set associative
What factors can be used to evaluate the performance of cache?
- Cache hit rate
- Miss rate, hit time
- Miss penalty
- Average Memory Access Time (AMAT)
What are the access times and costs associated with Static RAM (SRAM)?
Access time: 0.5ns to 2.5ns; Cost: $500 to $1000 per GB
What is spatial locality, and how does it affect cache design?
Spatial locality suggests that items near those accessed recently will likely be accessed soon; it influences the size of cache blocks
How does hit time affect the overall performance of a caching system?
Lower hit time improves performance by decreasing the time taken to access data from the cache
How do you calculate the hit rate in a caching system?
Hit rate = number of cache hits (h) / total data requests (n)
How does the size of the cache affect hit and miss rates?
Larger caches typically reduce miss rates by providing more space for data, while smaller caches may lead to more frequent cache misses
How does memory and cache impact processor performance?
They significantly reduce the time the CPU spends waiting for data, increasing throughput and speed
Describe the structure of a cache’s data block
Each block includes valid bits, tags, and the actual data being cached
What is an LRU (Least Recently Used) strategy and how is it implemented in caches?
LRU keeps track of the order of use of blocks and evicts the least recently used block when space is needed
How can valid bits help indicate whether data in a cache block is valid?
A valid bit is set to 1 when data is loaded into a cache block, indicating that the data can be used
What roles do the index and cache tag play in finding data in the cache?
The index identifies the cache block; the tag verifies that the data in that block corresponds to the requested address
How does the memory address map to the cache index using direct mapping?
The memory address is mapped using modulo division by the size of the cache
What are the two types of locality and why are they important for cache performance?
- Temporal locality (recently accessed items)
- Spatial locality (nearby items)
- They help determine what data should be cached to increase hit rates
What steps are involved in finding data in a cache (ICM)?
- Index a block in the cache
- Check the valid bit
- Match the cache tag with the address tag
What is the formula for miss rate and how is it derived?
Miss rate = 1 - hit rate = (n - h) / n
How does the access time of magnetic disk compare to that of SRAM?
Magnetic disk access time is significantly slower, ranging from 5,000,000ns to 20,000,000ns
What is the primary purpose of memory and cache in a computer system?
To store and quickly access data that the CPU needs, enhancing performance and efficiency
Describe the block replacement strategies used in associative caches
- Least Recently Used (LRU)
- Random replacement
- First-in-First-out (FIFO)