Question: . Access pattern is defined as the order in which the elements within a data structure are referenced. The access pattern can have a major

.Access pattern is defined as the order in which the elements within a data
structure are referenced. The access pattern can have a major impact on
performance when using a memory system that employs caches.
Consider a system that has a direct-mapped D-cache (data cache) containing 4096
lines. Each line is 256 bytes in size. The D-cache is initially empty. The matrix X with
256 rows and 256 columns is to be processed. The matrix resides in memory
starting at address 0x40010000. Each matrix element is 32 bits. Registers are used
for the array indices and no code optimizations are performed.
a)(3) If the matrix is stored in row major order, what is the miss ratio for the data
cache based on the matrix accesses made by the following code?
for (j=0; j<256; j=j+2;){
for {i=0; i<256; i=i+2}
X[i,j]= X[i,j]+ X[i+1,j];
}
}
b)(3) If the matrix is stored instead in column major order, what is the hit ratio for
the cache based on the matrix accesses made by the following code?
for (i=0; i<256; i=i+2;){
for {j=0; j<256; j=j+2}
X[i,j]= X[i,j]+ X[i+1,j];
}
}

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!