Cache Flashcards
Describe 1) what cache memory can improve in computing system and how 2) is this achieved?
- Cache memory can improve the average computational performance of a microprocessor system by having a parcial copy of the data from the main memory stored in a local, faster accessible cache memory.
- Cache is useful due the spatial locality and temporal locality properties.
What is spatial locality
data/ code you access most likely has data you will access soon in its vicinity.
What is temporal locality
data / code you access now, you will likely access soon again
compare and contrast direct mapping and associative cache mapping policies.
Direct Mapping
Advantage:
- temporal behavior can be analyzed
- simple implementation
Disadvantage:
- inefficient utilization of cache resources, if the program accesses multiple addresses frequently which are mapped to the same cache-line (conflict miss), many cache misses occur slowing down the execution.
- many unneccessary read/write operations
Associative mapping
Advantage:
- better use of cache space. less on-chip consuming
- simple for timing analysis
Disadvantage: more complex cache control
What is write through
done synchronously both to cache and main memory (next level cache)
What is write back
initially writing only to cache, write to main memory (next level cache) when data is replaced by new content
- more complex
Pro and cons for Fully associative cache
Adbvantages
- Simple and consumes less chip area
- Reasonably mimics LRU, hence, better performance than direct mapped
Drawbacks
- Slightly more complicated to predict
- slightly less performance compared to LRU
Set associative cache
Hybrid of gully associative and direct mapping
cache lines are grouped in sets
Data can go to any cache line within the set
Compare and contrast write through and write back
Write through
- A lower level memory is also updated on a write access
- Number of writes are higher;
- Simple but more energy consuming; - Depending on application, execution time may be longer;
- Generally employed if lower level memory is fast enough
Write back
- A lower memory is updated only when dirty line is evicted;
- less number of writes;
- Complex but more efficient;
- Execution time will be mostly shorter;
- Generally employed if lower level memory is slow (last level cache)