关于cache
29. When the following code fragment is executed on a computer with 32-bit integers and a fully-associative cache with 32-byte cache lines, how many bytes of the array a will be fetched into the cache from main memory?
int a[100];
for (i = 0; i < 17; sum += a[i], i++);
(a) at most 96. (b) exactly 3II. (c) exactly 17. (d) at most 68.
30. Your computer has 32-bit integers and a direct cache containing 128 32-byte cache lines. In the following code fragment, the compiler allocates a at address 0x800000 and b at address 0x801000. Before the execution of the code fragment, the arrays a and b have never been used, so they are not in the cache. What is the minimum number of bytes from each of the arrays a and b that could be fetched into the cache from main memory, during the execution of the code?
int b[1024];
int a[1024];
for (i = 0; i < 17; sum += a[i] + b[i], i++);
(a) 1088 (b) 96 (c) 68 (d) 17