Quiz
Solution
Q1:
Why the formula teff = tcache + ( 1 – h ) tmain
is only an approximation to the true performance?
A: This is because:
1.
Systems composed of independent random-access memories can
satisfy more than one access at a time.
2.
A processor need not generate a memory reference on every machine
cycle, particularly if the processor is waiting for input/output.
3.
Memory cycles can take longer than stated in the formula because
some requests can arrive at memory while memory is busy honoring earlier
processor requests generated by the input/output system.
Q2:
What is associative memory? Why does associative memory have a
longer cycle than a random-access memory built from identical
technology?
A:
A parallel memory that has the search capability, by which
searches can be achieved simultaneously, is called an associative
memory.
The associative memory having a longer
cycle than a random-access memory is strictly a consequence of the
need to propagate signals through a larger number of gates in the
associative memory than in a random-access memory of the equal size.
Q3: What are the advantages and disadvantages of
direct mapped cache?
A: The advantages are:
1.
No replacement algorithm necessary.
2.
Simple hardware and low cost.
3.
High speed of operation.
The disadvantages are:
1.
Performance drops significantly if accesses are made to
locations with the same index.
2.
Hit rate lower than associative mapping methods. However, as
the size of cache increased, the difference in the hit rates of the
direct and associative caches reduce and becomes insignificant.
Q4: What are the advantages of separate the
cache in to data cache and code cache?
A: First, the write policy would
only have to be applied to the data cache (assuming instructions are
not modified).
Second, separate paths could be provided from the processor to
each cache, allowing simultaneous transfers to both the instruction
cache and the data cache. This is particularly convenient in a
pipeline processor, as different stages of the pipeline access each
cache.
Another advantage is that a designer may choose to have
different sizes for the instruction cache and data cache, and have
different internal organizations and block sizes for each cache.
Q5:
Suppose tcache = 25ns, tmain = 200ns, h = 99%, w =
20%, and the memory data path fully matches the cache block size. What
is the average access time?
A:
from ta = tcache + (1
– h) ttrans + w(tmain – tcache)
We get ta = 25 + 0.01 * 200 + 0.2 * (200 – 25) =
62ns
Here the misses account for 2 ns ( =
(1 – h) ttrans ),
and the write policy account for 35 ns ( = w(tmain – tcache)
)
Q6:
How to extend the average access time formula to cover a second-level
cache?
A:
If only one-level cache the average access time is:
ta = tcache + (1 – h) tmain
extending to two-level cache:
ta = [tcache1 + (1 – h1)tcache2]
+ (1 – h2)tmain
where tcache1 is the first-level cache access
time,
tcache2 is the second-level cache access time,
tmain is the main memory access time,
h1 is the first-level cache hit rate,
h2 is the combined first/second-level cache hit
rate.