Question: . The following code is written in C , where elements of an array are allocated contiguously. Arrays a has 1 0 2 4 x

. The following code is written in C, where elements of an array are allocated contiguously. Arrays a has 1024x1024 elements. Arrays b and c have 1024 elements respectively. Assume each element of arrays is a 4-byte (32-bit) integer. The data type of all variables is a 4-byte integer also. Cache blocks are allocated on write miss, and the size of a cache line is 64 bytes. Assume that cache size is infinite (what?).(Hint: in this code, there are 6 variables: a, b, c, i, j, and sum)[12 pts total] int sum; for (int i =0; i <1024; i++){ sum =0; for (int j =0; j <1024; j++) sum += a[j+i*1024]+ b[j]; c[i]= sum; }(a) Which variable references exhibit temporal locality? [3 pts](b) Which variable references exhibit spatial locality? [3 pts](c) Lets focus on the data transfers for arrays a, b, and c. How many lw and sw instructions are issued while executing this code? [3 pts] Array a: Array b: Array c:

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!