Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HELP ME WITH PART D IN THIS QUESTION 1. In this exercise, we look at memo

ID: 3575175 • Letter: P

Question

PLEASE HELP ME WITH PART D IN THIS QUESTION

1.  In this exercise, we look at memory locality properties of matrix computation. The following code is written in C, where elements within the same row are stored contiguously. Assume each word is 32bit integer, and A and B are 16x16 integer arrays. (hint: 2D array in C stores in row first order).

For (I = 0; I < 15; I++)

For (J = 0; J < 15; J++)

A[I][J] = B[J][I] + A[J][0];

(a) How many 32bit integers can be stored in a 16byte cache block?

(b) References to which variables exhibit temporal locality?

(c) References to which variables exhibit spatial locality?

(d) Assume that starting address of matrix A is 0x1000, and the starting address of matrix B is 0x1800. Given a 512Byte 2way set associative data cache with write allocate. Assume each cache block is 16 Byte.  Estimate the cache hit ratio.

Explanation / Answer

a.

16 * 15 = 240/32 = 7

b.

During each iteration, the variables I and j are accessed and Operating System can take the values from temporal locality the variables I and j will remain in the temporal locality. So it is possible that the variables will accessed again.

c.

In this code the variables I and j will exhibit spatial locality because they are stored in cache.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote