Question: 1 . ( 5 points ) Consider the code below and answer the following questions. a . What is the total number of writes? b

1.(5 points) Consider the code below and answer the following questions.
a. What is the total number of writes?
b. What is the total number of writes that miss in the cache?
c. What is the miss rate?
1 struct point_color {
2 int c;
3 int m;
4 int y;
5 int k;
6}
7
8 struct point_color square[16][16];
9 int i, j;
10 for (i =0; i <16; i++){
11 for (j =0; j <16; j++){
12 square[i][j].y =1;
13}
14}
15 for (i =0; i <16; i++){
16 for (j =0; j <16; j++){
17 square[i][j].c =0;
18 square[i][j].m =0;
19 square[i][j].k =0;
20}
21}
Assume the following:
The system has a 2,048-byte direct-mapped data cache with 32-byte blocks
sizeof(int)=4
square begins at memory address 0
The cache is initially empty
The only memory accesses are to the entries of the array square
Variables i and j are stored in registers

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!