Explain the performance of cache in computer architecture?


The main reason for containing cache memory in a computer is to increase system performance by decreasing the time required to access memory. The component of cache performance are cache hits and cache misses.

Each time the CPU accesses memory, it determines the cache. If the requested data is in the cache, the CPU accesses the data in the cache, instead of physical memory, this is a cache hit. If the data is not in the cache, the CPU accesses the data from the main memory. This is a cache miss.

The average memory access time, TM is the weighted average of the cache access time, TC plus the access time for physical memory TP. The weighting factor is the hit ratio h. TM can be expressed as

                            TM=h TC+(1−h)TP

Since TC is much less than TP, increasing the hit ratio reduces the average memory access time. The table shows for TC=10 ns,TP=60 ns, and various values of h.

Hit ratios and average memory access times

h𝐓𝐌
0.060 ns
0.155 ns
0.250 ns
0.345 ns
0.440 ns
0.535 ns
0.630 ns
0.725 ns
0.820 ns
0.915 ns
1.010 ns

Consider that a computer system has an associative cache, a direct-mapped cache, or a two-way set-associative cache of 8 bytes. The CPU accesses the following locations in the order shown. The subscript for each value is the low-order 3 bits of its address in physical memory.

A0 B0 C2 A0 D1 B0 E4 F5 A0 C2 D1 B0 G3 C2 H7 I6 A0 B0

It can determine the hit ratio and average memory access times for this access pattern for each of the three cache configurations, assuming again that

TC=10 ns and

TP=60ns.

First, consider the associative cache. It is initially empty uses a FIFO replacement policy. The table shows the contents of the cache as each value is accessed. Seven out of the 18 accesses are hits, yielding a hit ratio of h = 0.389 and an average memory access time of

TM=40.56 ns.

Cache activity using associative ache

DataABCADBEFACDBGCHIAB

AAAAAAAAAAAAAAAAAA
C
BBBBBBBBBBBBBBBBB
A

CCCCCCCCCCCCCCCC
C



DDDDDDDDDDDDDD
H





EEEEEEEEEEEE
E






FFFFFFFFFFF













GGGGGG















HHHH
Hit?










Updated on: 27-Jul-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements