Return to course page

Given a 1KB set-associative cache with 2 lines per set and 16 bytes per block, with the LRU cache replacement policy,

Question 1: (see above) How many blocks are there in the cache?

Answer:

Question 2: (see above) How many bits long is the set index?

Answer:

Question 3: (see above) Assume that the cache is initially empty and we perform 8-byte data reads on the following addresses in the order listed:

  • 0x0000,
  • 0x0008,
  • 0x1000,
  • 0x1028,
  • 0x0000,
  • 0x2000,
  • 0x0008,
  • 0x1000,
  • 0x1028

How many cache hits will this access pattern experience?

Answer:

Question 4 (0 points): Which of the following is probably a bad idea if memory reads have good locality but memory writes do not have locality?

  1. write-back

  2. write-through

  3. write buffers

  4. loop reordering

  5. memory blocking

Question 5: The loop order

for(int i = 0; i < N; i += 1)
    for(int j = 0; j < N; j += 1)

is the most efficient for which of the following loop bodies? Assume N is a large number

  1. a[i][j] = a[i][j]*2;

  2. a[j][i] = a[i][j]*2;

  3. a[i][j] = a[j][i]*2;

  4. a[j][i] = a[j][i]*2;

Return to main page
Return to course page