Question: or the given code snippets, predict the cache hit rate. The cache is 1 6 KB , direct mapped, and has 1 2 8 -

or the given code snippets, predict the cache hit rate. The cache is 16KB, direct mapped, and has 128-byte cache lines. There are two implementations for the for loops (v1 and v2) which are executed separately in isolation. Assume that the:
long variables total_sum and array arr are doublewords
the cache is empty before the loops start executing.
If you need any other assumptions to solve this question, state them in your answer.
// Version v1
for(int i=0; i<128; i++){
for (int j=0; j<128; j++){
total_sum += arr[i][j];
}
}
// Version v2
for(int i=0; i<128; i++){
for (int j=0; j<128; j++){
total_sum += arr[j][i];
}
}
What is the cache hit rate in Version v1?(3 pts)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!

Q:

26