Sizing Your Cache
As you may have guessed: when it comes to cache memory, more is better. However, you
may have also guessed that there are limits and exceptions to how much cache a system
will support. Adding cache or more cache to a PC can increase its overall speed. On the
other hand, adding cache or more cache to a PC can decrease its performance, too. You
can add so much cache to a system that simply keeping the cache filled from RAM begins
eating up all of the CPU cycles that you were hoping to save.
If one refrigerator provides enough caching storage to eliminate some trips to the
store for drinks, then it seems to make sense that two refrigerators could save twice as
many trips. There is some logic to this, but your savings are dependent on your ability to
carry two refrigerator’s worth of drinks on each trip. If you are unable to carry enough to
fill both refrigerators on a single trip, then you will need to make a second trip that seri-
ously eats into your time savings.
Adding too much external (L2) cache to some PCs can affect the system’s perfor-
mance in this same way. Where adding a first 256K of cache improves the performance of
a PC, adding an additional 256K may in fact reduce its performance.
Too Much RAM
Most Pentium-class PCs included enough cache memory to cache 64MB of RAM. This has
emerged as the standard sizing for L2 cache on most newer systems. However, the PC’s
chipset determines how much main memory (RAM) is cached, and many of the more popu-
lar chipsets do not cache more than 64MB of RAM. What this means is that regardless of
how much RAM you add to the system, it will not cache more that 64MB. This can be an is-
sue if you wish to add more memory to your PC than it is capable of caching. Doing so will
likely degrade the performance of the PC and leave you wondering why adding more RAM
caused the PC to operate slower.
When there is memory installed on a PC in excess of its caching limit, all of the extra
memory isuncached. This means that all of the requests for data or instructions stored in the
uncached portion of RAM take longer to be served. The CPU must wait for the data to be lo-
cated in RAM and then transferred over the data bus, in addition to the overhead of first de-
termining that the data was indeed in the uncached memory. If 256MB of RAM is added to a
PC that only caches 64MB of that RAM, nearly three-fourths of the RAM is uncached, and
the system is a lot slower than it was with only 64MB of RAM.
Caching Impacts on Memory
Everyone knows that adding more and faster memory to your PC will make it perform
better and faster. Right? Well, not so. In fact, the size of a PC’s cache can neutralize, or at
least seriously reduce, the benefit of adding more and faster memory. A PC with a large
L1 and L2 cache very likely serves nearly all data and instruction requests from cache.
Since the cache system is able to accurately predict the CPU’s next request about 90 to 95
percent of the time, only 5 to 10 percent of these requests are ever served from RAM.
Adding additional or faster memory will only impact the performance of 5 to 10 percent
Chapter 8: Cache Memory^161