Cache memoryyyyyy


#1


#2

Size of the loop=n×b=k×m×bSize of the loop=n×b=k×m×b

Size of a set=k×b Size of a set=k×b (k−way k−way associative)

Here, size of the loop is smaller than size of a set as m≤lm≤l. Now, however be the mapping (whether all be mapped to the same set or not), we are guaranteed that the entire loop is in cache without any replacement.

For the first iteration:

No. of accesses=n×b No. of accesses=n×b
No. of misses=n No. of misses=n as each new block access is a miss and loop body has n
n blocks each of size b
b for a total size of n×b

For, the remaining 99 iterations:

No. of accesses=n×b No. of accesses=n×b
No. of misses=0 No. of misses=0

So, total no. of accesses=100nb total no. of accesses=100nb

Total no. of hits=Total no. of accesses−Total no. of misses
Total no. of hits=Total no. of accesses−Total no. of misses

=100nb−n =100nb−n

So, hit ratio=100nb−n100nb=1−1100b hit ratio=100nb−n100nb =1−1100b

The hit ratio is independent if ll, so for l=1l=1 also we have hit ratio=1−1100b