views:

539

answers:

4

I am using 32 bit RHEL 4.4 on AMD64 based hardware. Here is the output from uname -a

$ uname -a
Linux zulu 2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:17:21 EST 2007 i686 athlon i386 GNU/Linux

I have 8Gigs of memory installed on this system, OS being 32 bits I would assume that my system will not be able to make use of full 8GB memory. But when I run top, I see the following -

Mem:   8309168k total,  8292028k used,    17140k free,     7096k buffers

So, top is able to view all 8GB of memory.

If I install 32 bit WinXP in same machine, task manager just shows 3 GB as available.

My question is - How is 32 bit OS able to see 8GB memory? Does this mean that my applications will be able to use larger address space? And why is the difference between 32 bit Linux and 32 bit WinXP?

Thanks!

+3  A: 

Your Linux system supports Physical Address Extension.

Kristof Provost
A: 

The method enabling this is called "PAE" (Physical address extension). Your CPU is able to use 36bit addresses internally, and your OS supports it. Unfortunately, Windows XP only uses PAE in order to support the NX bit (No eXecution bit, causes an exception to occur when the processor tries to execute code from a page marked with this bit). 32bit Linux kernels support PAE.

ASk
+2  A: 

There are different 'levels' of memory. What is impossible, whatever the OS, is to address more than 4Gb in one process, since your pointers are too small for more than that - that's the fundamental limitation of 32 bits w.r.t memory. On linux and windows, and most 'traditional' OSs I would guess, the 32 bits virtual address space is split into one part for the kernel and one part for the process, so you get less than 4 Gb of addressable content for each process.

But still, the OS could use more than 4 Gb - for example, having 2-3 processes each consuming 2 Gb of memory. Even 32 bits CPU can address more than 4 Gb of memory (at the hardware level), but in the virtual address space, you are always limited by your 32 bits pointers.

The old new thing has a good explanation on the differences between physical address space, virtual address space and co: http://blogs.msdn.com/oldnewthing/archive/2004/08/18/216492.aspx

David Cournapeau
A: 

Newer i386-compatible CPUs can address more than 4 GB using PAE mode. Windows XP artificially limits the address space to 4GB because there are too many poorly written hardware drivers that assume all DMA is will be done to memory below 4 GB. So, about 1 GB of the 4 GB address space is mapped to hardware, the rest to physical RAM. Windows server editions don't have this limitation. Linux kernels that support PAE don't limit memory either. Both of these support up to 32GB, if I remember correctly.

Your application is limited to somewhere between 2-3 GB of address space, depending on OS options. One application can effectively use more physical RAM than that by windowing portions of memory in and out of that address space, using address windowing extensions, or memory mapped files, for example.

karunski