W 08 Data Replacement Algorithms for Memory
W 08 Data Replacement Algorithms for Memory
• What is the size of memory if there are 12 address lines and 16 data
word?
= 1k x 22 x 2 x 8 bit
= 1kB x 4 x 2 Byte
= 8kB
Key Concepts
1. Cache: A small, high-speed storage used to hold frequently
accessed data.
2. Cache Block: The unit of storage in the cache, holding a portion
of memory data.
3. Cache Miss: When data needed by the CPU is not found in the
cache.
Cache Logic
Cache logic is the set of rules and mechanisms that control
the cache operates, including data placement, replacement,
and eviction.
Example Algorithms:
3. Random Replacement:
Randomly chooses a block to evict.
4. Optimal Algorithm:
Evicts the data that will not be needed for the
longest future time (used for theoretical purposes).
Write Policy
Control how data modifications are written back to memory.
Question 2
Which of the following cache types is the fastest but smallest in size?
A. L1 Cache
B. L2 Cache
C. L3 Cache
D. Main Memory
Question 3
In which cache mapping technique can a memory block be stored in any
cache line?
A. Direct Mapping
B. Associative Mapping
C. Set-Associative Mapping
D. Random Mapping
Question 5
What is the main challenge of maintaining cache coherence in multi-core processors?
A. Ensuring each core has its separate cache
B. Preventing cache lines from being overwritten
Examples data
C. Synchronizing should be shown
updates using
across this cores
multiple
D. Increasing cache size without reducing speed
1. Answer: C
2. Answer: A
3. Answer: B
5. Answer: C