Question: Problem 3 . ( 2 0 points ) : On a machine with a 1 0 2 4 - byte direct - mapped data cache

Problem 3.(20 points):
On a machine with a 1024-byte direct-mapped data cache with 32 byte blocks, you are given the following
definitions:
struct point {
int x;
int y;
};
struct point array[16][16];
register int i, j;
Assume:
sizeof(int)=4
array begins at memory address 0
The cache is initially empty.
The only memory accesses are to the elements of array. Variables i and j are stored in registers.
Given the following code:
1. for (i=0; i<16; i++){
2. for (j=0; j<16; j++){
3. array[i][j].x =0;
4. array[i][j].y =0;
5.}
6.}
7.
8. for (j=0; j<16; j++){
9. for (i=0; i<16; i++){
10. array[i][j].x =0;
11. array[i][j].y =0;
12.}
13.}
A.(2 points) When executing line 3 for the first time (i.e., array[0][0].x =0), which array elements
will be loaded into the cache? (3 points) Explain your reasoning.
B.(2 points) When executing line 10 for the first time (i.e., array[0][0].x =0), is it a hit or miss? (3
points) Explain your reasoning.
C.(2 points) What is the miss rate for the first loop? (3 points) Explain your reasoning.
D.(2 points) What is the miss rate for the second loop? (3 points) Explain your reasoning.

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!