Hardware Reference
In-Depth Information
improving performance. Without the L1 cache, a processor would frequently be forced to
wait until system memory caught up.
Cacheisevenmoreimportantinmodernprocessorsbecauseitisoftentheonlymemoryin
the entire system that can truly keep up with the chip. Most modern processors are clock
multiplied,whichmeanstheyarerunningataspeedthatisreallyamultipleofthemother-
board into which they are plugged. The only types of memory matching the full speed of
the processor are the L1, L2, and L3 caches built into the processor core.
See Memory Module Speed ,” p. 344 ( Chapter 6 ).
If the data that the processor wants is already in L1 cache, the CPU does not have to wait.
If the data is not in the cache, the CPU must fetch it from the Level 2 or Level 3 cache or
(in less sophisticated system designs) from the system bus—meaning main memory dir-
ectly.
How Cache Works
To learn how the L1 cache works, consider the following analogy.
This story involves a person (in this case, you) eating food to act as the processor re-
questing and operating on data from memory. The kitchen where the food is prepared is
the main system memory (typically double data rate [DDR], DDR2, or DDR3 dual inline
memory module [DIMMs]). The cache controller is the waiter, and the L1 cache is the
table where you are seated.
Okay, here's the story. Say you start to eat at a particular restaurant every day at the same
time. You come in, sit down, and order a hot dog. To keep this story proportionately ac-
curate, let's say you normally eat at the rate of one bite (byte? <grin>) every four seconds
(233MHz = about 4ns cycling). It also takes 60 seconds for the kitchen to produce any
given item that you order (60ns main memory).
So, when you arrive, you sit down, order a hot dog, and you have to wait for 60 seconds
for the food to be produced before you can begin eating. After the waiter brings the food,
you start eating at your normal rate. Pretty quickly you finish the hot dog, so you call the
waiter over and order a hamburger. Again, you wait 60 seconds while the hamburger is
being produced. When it arrives, you again begin eating at full speed. After you finish the
hamburger, you order a plate of fries. Again you wait, and after the fries are delivered 60
seconds later, you eat them at full speed. Finally, you decide to finish the meal and or-
der cheesecake for dessert. After another 60-second wait, you can eat cheesecake at full
speed.Youroveralleatingexperienceconsistsofalotofwaiting,followedbyshortbursts
of actual eating at full speed.
Search WWH ::




Custom Search