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

Problem 3. Given a 32-bit Linux system that has a 2-way set associative cache of

ID: 3772124 • Letter: P

Question

Problem 3. Given a 32-bit Linux system that has a 2-way set associative cache of size 128 bytes with 32 bytes per block. Long longs are 8 bytes. For all parts, assume that table starts at address 0x0. (cache size of 5 questions below are both 128 bytes) int i; int j; long long table[8][4]; for (j = 0; j < 8; j++) { for (i = 0; i < 4; i++) { table[j][i] = i + j } } A. What is the miss rate of this code sample? Why? (3 points) B. What is the miss rate for 16-bytes per cache blocks cache of this code sample? Why? (3 points) C. What is the miss rate for 16-bytes per cache blocks, 4- way set associative cache of this code sample? Why? (3 points) D. What is the miss rate for 64-bytes per cache blocks, direct-mapped cache of this code sample? Why? (3 points) E. if it is a 2-way set associative cache of size 128 bytes with 32 bytes per block cache, can we improve the cache hit rate by modifying the code? Why? And if yes, how? (3 points)

Explanation / Answer

1)The cache will on the initial read, cold cache, and when I = 3. This is because the block size is 32 bytes and that can hold eight elements of table. Since two can are stored in 2-way set associative that means sixteen elements are in cache. Sixteen elements is the equivalent of two rows of the table Eg) table[0][x] and table[1][x]
2) would have twice as many cache misses as in A, because the blocks can hold half as much data. It would have a cache miss every time function enters the “i loop”
3) It would be the same as in A, because the data size is cut in half however the number of blocks loaded into cache is doubled.
4) It would miss 4 times because the whole array is 256 bytes (8*4*8) and it will be able to load 64 bytes of data every miss 256/64=4

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