A system has a cache memory. However, the program running on the system…
A system has a cache memory. However, the program running on the system accesses memory locations randomly and never repeats the same memory location.
Explain how this affects cache hit ratio, system performance, and memory hierarchy efficiency.
Attempted by 75 students.
Show answer & explanation
Cache hit definition
Cache hit occurs when requested data is found in cache memory.
Introduction to Memory Hierarchy
Cache miss definition
Cache miss occurs when requested data is not present in cache and must be fetched from main memory.
Introduction to Memory Hierarchy
Given scenario
Memory accesses are random.
No data reuse.
No locality of reference.
Effect on cache hit ratio
Hit ratio becomes extremely low.
Almost every access becomes a cache miss.
Diagram of situation
Normal case
CPU → Cache → Main Memory
(Hit)Random access case
CPU → Cache → Miss → Main MemoryEffect on system performance
CPU must frequently wait for main memory.
Memory access time increases.
Effect on memory hierarchy
Cache becomes ineffective.
Hierarchy advantage reduces.
Example
Sequential access
A[0], A[1], A[2], A[3]High spatial locality → high cache hits.
Random access
A[10], A[9000], A[120], A[55000]No locality → cache misses.
Conclusion
Cache performance strongly depends on locality of reference.