This is a message that I posted to the United Devices Member Message Board on May 29, 2001, to help another volunteer understand how a PC’s CPU interfaces to memory.
From: http://forum.ud.com/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=4&t=000629
Wayne Farmer
posted May 29, 2001 14:27
quote:
--------
Originally posted by Jack007:
Ok, my computer people here in the
real world can't give me a straight answer (ie they don't know) So I have to
come here to my source of all wisdom. UD member lounge.
I need to know what the relationship
is between a computer's processor and it's RAM. Let me tell you what I'm
running. An AMD 1 GHZ with 512 megs of PC2100 DDR RAM. Supposedly it's running
at 266 mhz. Also the motherboard is 266mhz FSB as well. So whenever the
processor access the memory it's doing it at 266. Here's my question, how often
does your computer access the RAM to do calculations (lets say in the THINK
program for instance). Is it so often that basically all your computer is doing
is 266 mhz anyway? or is it only occassionally so you get the 1 ghz most of the
time??? I will say this though, it's definitly a lot faster than my P3600 with
384 PC100 RAM. I'm really curious to know, I'll be checking periodically for
replies Thanks in advance to all the Blabbs and anyone else who might know (but
I thought all those who knew WERE already Blabbs.... I'm so confused)
--------
Well, Jack007, if your computer
people can't give you a straight answer, then either they haven't been very
well trained, or don't know how to explain what they know. But I think I can
give you a straight answer. (Credentials at my home page; click the
"house" icon above.)
You're correct in wondering how a CPU
can run at 1 GHz if the memory can only run at 266 MHz. The answer is, it
can't, unless some extra hardware is added to help it. And, in fact, that's
what is done on all current PC systems: the storage is organized in a hierarchy
of speed and size. Think of it this way: you don't go to the store everytime
you want a glass of orange juice. You go to your refrigerator, right, because
it's quicker. But if there's no orange juice in your refrigerator, you have to
go to the supermarket and get some there, then bring it back to the
refrigerator. PC's work the same way.
Between the CPU and the DDR RAM,
there are two additional layers of memory. (In my Pentium III Coppermine,
they're both inside the Pentium III chip.) The first layer, closest to the CPU,
is called Level 1 cache (abbreviated L1 cache). The second layer, between the
Level 1 cache and the DDR RAM, is called Level 2 cache (abbreviated L2 cache).
Finally, there's the hard drive. You can picture it all like this:
CPU <---> L1 cache <--->
L2 cache <---> DDR RAM <---> Cache inside hard drive <--->
Hard drive
The L1 cache is smallest (e.g. 32
KB), and is very fast; typically, it can be read at the full CPU cycle rate.
The L2 cache is bigger (e.g. 256 KB), and can be read at a speed somewhere
between the L1's rate and the DDR's rate. The DDR RAM is bigger (e.g. 128,000
KB = 128 MB) and slower than either of the L1 and L2 caches. Inside the hard
drive, there's usually another cache (e.g. 2,000 KB = 2 MB). Finally, the hard
drive's platters are biggest of all (e.g. 30,000,000 KB = 30 GB) and slowest of
all.
Initially, when you turn the computer
on, the L1 cache, L2 cache, and hard drive cache memory are empty. The DDR
memory is empty except for a small part of it that has a copy of what's in the Flash
BIOS chip. When the CPU needs instructions or data, it always looks first into
the L1 cache, to see if what it needs is there. If not, a "L1 cache
miss" is said to have occurred, and it tries to get it from the L2 cache.
If it's not there, then an "L2 cache miss" is said to have occurred,
and it tries to get it from the DDR memory. And if it's not there, a "page
fault" is said to have occurred, and it tries to get it by
"swapping" instructions or data in from the hard drive.
The L1 cache and L2 cache both try to
hold the memory information that is most frequently needed, so that the CPU
experiences many more cache "hits" than cache "misses". In
practice, this works quite well, and is very necessary to achieve high
performance. A well-designed program and operating system may have an "L1
cache hit rate" of 99% or more!
If DDR memory could run at internal
CPU speed, then there wouldn't be any need for L1 cache and L2 cache, and the
system would run really fast. But it's currently too expensive and impractical
to do this, and so the cache memories are used.
If you download this excellent free
utility (http://www.sisoftware.co.uk/sandra) you'll be able to see
detailed information about the amount of cache you have, and how fast it is.