The diagram above illustrates a blocked, direct-mapped cache for a
computer that uses 32-bit data words and 32-bit byte addresses.
What is the maximum number words of data from main memory that can be
stored in the cache at any one time?
How many bits of the address are used to select which line of the
cache is accessed?
How many bits wide is the tag field?
Briefly explain the purpose of the one-bit V field associated with each cache line.
Assume that memory location 0x2045C was present in the cache. Using
the row and column labels from the figure, in what cache location(s)
could we find the data from that memory location? What would the
value(s) of the tag field(s) have to be for the cache row(s) in which
the data appears?
Can data from locations 0x12368 and 0x322FF8 be present in the cache
at the same time? What about data from locations 0x2536038 and
0x1034? Explain.
When an access causes a cache miss, how many words need to be fetched
from memory to fill the appropriate cache location(s) and satisfy the
request?
If a cache access requires one clock cycle and handling cache
misses stalls the processor for an additional five cycles, which of
the following cache hit rates comes closest to achieving an average
memory access of 2 cycles?
LRU is an effective cache replacement strategy primarily
because programs
If increasing the associativity of a cache improves performance
it is primarily because programs
If increasing the block size of a cache improves performance it
is primarily because programs
A fully-associative cache using an LRU replacement policy
always has a better hit rate than a direct-mapped cache with the same
total data capacity.
Consider the following program:
integer A[1000];
for i = 1 to 1000
for j = 1 to 1000
A[i] = A[i] + 1
When the above program is compiled with all compiler optimizations
turned off and run on a processor with a 1K byte direct-mapped write-back
data cache with 4-word cache blocks, what is the approximate data cache
miss rate? (Assume integers are one word long and a word is 4 bytes.)
In a non-pipelined single-cycle-per-instruction processor with
an instruction cache, the average instruction cache miss rate is 5%.
It takes 8 clock cycles to fetch a cache line from the main memory.
Disregarding data cache misses, what is the approximate average CPI
(cycles per instruction)?
Consider an 8-line one-word-block direct-mapped cache
initialized to all zeroes where the following sequence of word
addresses are accessed:
1, 4, 5, 20, 9, 19, 4, 5, 6, and 9.
Which of the following tables reflect the final tag bits of the
cache?
address: 1 4 5 20 9 19 4 5 6 9 line #: 1 4 5 4 1 3 4 5 6 1 tag: 0 0 0 2 1 2 0 0 0 1So, figure (E) represents the final tag bits of the cache.
Consider the following partitioning of a CPU's 32-bit address
output which is fed to a direct-mapped write-back cache:
What is the memory requirement for data, tag and status bits of the cache?15 tag bits 1 valid bit 1 dirty bit (since this is a write-back cache) 128 data bits (16 bytes/cache line) === 145 bits per cache lineTotal storage required = 8192*145 bits = 1,160K bits.
Write an expression for the average memory access time for a 1-Mbyte
cache and a B-word block size (in terms of the miss ratio m and B).
What block size yields the best average memory access time?
Which cache would you expect to take the most chip area (hence cost) ?
Which cache is likely to perform worst in a benchmark involving
repeated cycling through an array of 6K integers ? Explain.
It is observed that one of the caches performs very poorly in a
particular benchmark which repeatedly copies one 1000-word array to
another. Moving one of the arrays seems to cure the problem. Which
cache is most likely to exhibit this behavior ? Explain.
Recall that we say cache A dominates cache B if for every input
pattern, A caches every location cached by B. Identify every pair (A,
B) of caches from the above list where A dominates B. Explain your
reasoning.
Which cache(s) have the best hit rate for the
sequence 0, 16, 4, 36, ...
Which cache(s) have the best hit rate for the sequence 0, 4, 8,
12, 16, 20, 24, 28, 32, ...
Which cache(s) have the best hit rate for the sequence 0, 4, 8,
12, 16, 20, 24, 28, 32, 28, 24, 20, 16, 12, 8, 4, ...
Which cache(s) have the best hit rate for the sequence 0, 4, 8,
12, 32, 36, 40, 44, 16, ..
Assume that a cache access takes 1 cycle and a memory access
takes 4 cycles. If a memory access is initiated only after the cache has
missed, what is the maximum miss rate we can tolerate before use of
the cache actually slows down accesses?
| Model | Associativity | Total data size (bytes) | Write- |
|---|---|---|---|
| DEFINATELY | four-way | 216 | back |
| CERTAINLY | direct-mapped | 216 | back |
| HOPEFULLY | 4-way | 210 | through |
| PERHAPS | 2-way | 210 | back |
| DOUBTFULLY | direct-mapped | 210 | back |
access 100: miss; cache contains 100, ---, --- access 200: miss; cache contains 200, 100, --- access 104: miss; cache contains 104, 200, 100 access 204: miss; cache contains 204, 104, 200 access 200: hit; cache contains 200, 204, 104 access 100: miss; cache contains 100, 200, 204 access 200: hit; cache contains 200, 100, 204 access 104: miss; cache contains 104, 200, 100 access 204: miss; cache contains 204, 104, 200 access 200: hit; cache contains 200, 204, 104 ...So in the steady state, location 200 stays in the cache and all other locations get replaced. So the hit rate is 2/5 or 40%.