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
  1. Cache hit definition

    • Cache hit occurs when requested data is found in cache memory.

      Introduction to Memory Hierarchy

  2. 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

  3. Given scenario

    • Memory accesses are random.

    • No data reuse.

    • No locality of reference.

  4. Effect on cache hit ratio

    • Hit ratio becomes extremely low.

    • Almost every access becomes a cache miss.

  5. Diagram of situation

Normal case

CPU → Cache → Main Memory
     (Hit)

Random access case

CPU → Cache → Miss → Main Memory
  1. Effect on system performance

    • CPU must frequently wait for main memory.

    • Memory access time increases.

  2. Effect on memory hierarchy

    • Cache becomes ineffective.

    • Hierarchy advantage reduces.

  3. 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.

  1. Conclusion

    • Cache performance strongly depends on locality of reference.

Explore the full course: Zero To Hero

Loading lesson…