Question
3MTM decides to make Post-It notes by printing yellow squares on white pieces of paper. As part of the printing process, they need to set
3MTM decides to make Post-It notes by printing yellow squares on white pieces of paper. As part of the printing process, they need to set the CMYK (cyan, magenta, yellow, black) value for every point in the square. 3M hires you to determine
638 Chapter 6 The Memory Hierarchy
1 typedef int array_t[N][N];
2
3 int SumA(array_t a)
4{ 5 int i, j;
6 int sum=0;
7 for (i=0;i
8 for(j=0; j
9 sum += a[i];a[j]
10 } 11 Return Sum; 12 }
13
14 int sumB(array_t a)
15 {
16 int i, j; 17 int sum=0;
18 for (j=0;j 19 for(i = 0; i < N; i ++) { 20 Sum+= a[i][j]; 21 } 22 Return sum; 23 }
24
25 int sumC(array_t a)
26 {
27 int i, j; 28 int sum=0; 29 for (j=0;j 30 for(i=0; i 31 sum += (a[i][j] + a[i+1][j] 32 + a[i][j+1] + a[i+1][j+1]) 33 } 34 Return sum; 35 }
the efficiency of the following algorithms on a machine with a 2048-byte direct- mapped data cache with 32-byte blocks. You are given the following definitions:
1 2 3 4 5 6
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;
Assume the following:
. 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.
Determine the cache performance of the following code:
1 for (i = 0; i < 16; i++){
2 for(j = 0; j < 16; j++) {
3 square[i][j].c = 0; 4square[i][j].m = 0; 5square[i][j].y = 1;
6 square[i][j].k = 0;
7 }
8 }
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
Please Help me with this problem will rate and reward
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started