[dba-Tech] A few hardware/memory questions

jwcolby jwcolby at colbyconsulting.com
Tue May 20 09:47:17 CDT 2008


 >Is there a performance boost with the mapped memory if you've got 4 GB 
installed?  If so then the reverse is true if you've only got 2 GB win 
no mapping?

Hmm.. there is a performance boost IF you need more than 2 gigs of 
memory.  If not then it may never be used, though this is unlikely.

If you have so much memory that Windows cannot map the video card and 
other things it needs to map, then it carves holes in the memory.  Does 
it take longer to access this memory?  I don't think so.  What happens 
is that the processor can "translate" memory requests, and does all of 
the time.

The video card has some amount of memory physically on the card, little 
memory chips right on the card.  That may be 32 meg or it might be 512 
meg.  Let's assume for argument's sake that it has 512 megs.

That memory has to be "mapped" somewhere within the total 4 gigs that 
the 32 bit address register can address.  So... Windows says "this 512 
megs will be physically located at the very upper 512 megs of the 4 gig 
address range".  It programs the card itself to "answer up" when it sees 
an address on the bus between 3.5 and 4 gigs.  In the meantime it 
"carves" a hole out of the memory such that the memory sticks no longer 
"answer up" between those addresses.  The memory now answers up between 
0 and 3.5 gigs and the video card now answers up between 3.5 gig and 4 
gig.  There are actually other things that take MUCH smaller chunks as 
well, the video card is just the "worst offender".

If you think about this though, what happens if you only have 2 gigs? 
The video still gets 3.5-4 gigs.  The memory gets 0-2 gigs.  There is a 
"hole" between 2 and 3.5 gigs but it is not there because Windows 
"carved it out" it is just there because there is no device occupying 
that space.

Now... add another 1 gig memory stick.  There is now memory between 0 
and 3 gigs, a hole between 3 and 3.5 gigs and video between 3.5 and 4 gigs.

Now add another 1 gig stick.  Suddenly the new memory wants the range 
between 3 and 4 but the video also wants that range.  Windows steps in 
and "programs" the memory to not answer up between 3.5 and 4 gigs, so 
that last additional 1 gig stick only "adds" .5 gigs of ram to your 
system.  The other .5 gigs is physically in the machine but 
electronically inactive.

Remember that this whole problem exists because there are only 32 bits 
available for the address buss.  So what happens if you go to an x64 
windows (or Linux)?  These OS' have something like 48 address bits. 
2^32 is 4 gigs, 2^48 is 281,474,976,710,656 bytes - 281.5 terabytes.  So 
there is no longer a need to "carve holes" to shoehorn the video ram in, 
it is just mapped waaaaaaaay up in memory and you can use ALL of the 
memory installed in your machine.

I have two servers running Windows 2003 x64 and each has 8 gigs 
installed and usable, all 8 gigs usable.

However... the motherboard of the specific computer determines how much 
memory can be added.  It may only run 33 physical address lines to the 
DIMM sockets, in which case 8 gigs (2^33) is the max you can install. 
If they run 34 address lines to the DIMMs then you could install 16 
(2^34) gigs of ram etc.

In summary, NO carving will occur with an x64 OS.  With an x32 system 
the only time you will have carving is if you have more memory than will 
fit in 4 gigs when the video (and other much smaller) memory 
requirements are considered.

There is one more piece of the puzzle.  In a modern computer, it is best 
to install PAIRS of memory modules because the machine will load data 
out of BOTH modules at the same time, thus the load speed of the memory 
will be twice what it would be if there were only a single (unpaired) 
module.

We all know that the computer caches memory.  What literally happens is 
that the program asks for a single memory address (1,2,4,8 or even 10 
bytes depending on the instruction) but the memory controller loads an 
entire BLOCK of memory, usually something like 32, 64 or 128 bytes, and 
stores the rest in the cache on the processor.

I have no idea what my laptop does, but I know that my desktops use 
DIMMs which are 64 bits wide.  Thus a single memory cycle loads 8 bytes 
from EACH DIMM.  If I have pairs of DIMMS, then BOTH DIMMS (can) return 
memory each memory cycle, so 16 bytes of memory data are returned in a 
single memory cycle.  The processor's registers are 32, 64 or 80 bits 
(floating point numbers for the math processor), so any data not 
specifically asked for remains in the cache and is available should the 
program need it later.

Thus if you put THREE modules in the machine (for 3 gigs for example) 
you would have access to all three gigs BUT the memory between 2 and 3 
gigs would only run at half the bandwidth of the memory between 0 and 2 
gigs.  Therefore if memory is cheap enough, it is often useful to buy 
all four gigs and just "waste" the "carved" memory because it will make 
the machine faster when it uses the upper pair of memory DIMMs.

All clear now?

;-)

John W. Colby
www.ColbyConsulting.com


Steve Erbach wrote:
> John,
> 
> "What we have here is a failure to commun'cate"
> 
> BLAM!
> 
> Oh, yeah!
> 
> I was curious about what you said here:
> 
> » What happens if you install less than 4 gigs (only 2 gigs)?  Windows no
> longer has to carve the holes out to map the memory of the video card so
> you end with with ALL of that 2 gigs available as memory. «
> 
> So, if you have MORE than 2 GB of RAM, Windows will "carve holes" in
> RAM but if you have 2 GB or LESS then it doesn't?  Sounds funny.  Is
> there a performance boost with the mapped memory if you've got 4 GB
> installed?  If so then the reverse is true if you've only got 2 GB win
> no mapping?
> 
> Steve Erbach
> Neenah, WI



More information about the dba-Tech mailing list