Question: In the previous dotprod example, what fraction of the total references to x and y will be hits once we have padded array x? Example:

In the previous dotprod example, what fraction of the total references to x and y will be hits once we have padded array x?

Example:

For example, instead of defining x to be float x[8], we define it to be float x[12]. Assuming y starts immediately after x in memory, we have the following mapping of array elements to sets: 

Element x [0] x [1] x [2] x [3] x [4] x [5] x [6] x [7] Address 0 4 8 12 16 20 24 28 Set index 0 0 0 0 1 1 1

With the padding at the end of x, x[i] and y[i] now map to different sets, which eliminates the thrashing conflict misses.

Element x [0] x [1] x [2] x [3] x [4] x [5] x [6] x [7] Address 0 4 8 12 16 20 24 28 Set index 0 0 0 0 1 1 1 1 Element y [0] y [1] y [2] y [3] y [4] y [5] y [6] y [7] Address 48 52 56 60 64 68 72 76 Set index 1 1 1 1 0 0 0 0

Step by Step Solution

3.39 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To calculate the fraction of total references to x and y that will be hits after padding array x we ... View full answer

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 Computer Systems A Programmers Perspective Questions!