# 4GB of RAM on a 32-bit x86 system

## Shining Arcanine

I recently mounted tmpfs on /var/tmp/portage and while it is nice, I am rapidly discovering that 2GB of RAM is not enough, especially when compiling open office, so I am thinking of an upgrade to 4GB of RAM. I am well versed on the issue of 4GB of RAM on 32-bit x86 systems for Windows, but I am not so well versed on it for Linux. Googling for an answer seems to indicate that Linux and Windows are similar in the respect that a typical Linux kernel will not fully address 4GB of RAM. It also seems that I can enable 64GB High Memory support to work around this.

Before I order more memory, I would like to know, are there any issues (i.e. performance, stability or anything else I might notice) with this approach?

----------

## EzInKy

 *Shining Arcanine wrote:*   

> I recently mounted tmpfs on /var/tmp/portage and while it is nice, I am rapidly discovering that 2GB of RAM is not enough, especially when compiling open office, so I am thinking of an upgrade to 4GB of RAM. I am well versed on the issue of 4GB of RAM on 32-bit x86 systems for Windows, but I am not so well versed on it for Linux. Googling for an answer seems to indicate that Linux and Windows are similar in the respect that a typical Linux kernel will not fully address 4GB of RAM. It also seems that I can enable 64GB High Memory support to work around this.
> 
> Before I order more memory, I would like to know, are there any issues (i.e. performance, stability or anything else I might notice) with this approach?

 

4gb is a hardware limitation, that is why Linux and Windows are similar in that respect. The work around is PAE, which uses page tables to take advantage of your additional memory. Personally, though I do believe that segmentation is actually beneficial when it comes to security, I don't understand why 64bit kernels aren't the default since they are fully capable of executing 32bit programs. Emulators are surely capable of meeting the needs of those who still depend on 16bit or less programs.

----------

## gentoo_ram

Unfortunately, there's no definite answer to your question other than "it depends".  It is possible to see 4 (or more) GB of physical RAM on a 32-bit system.  It all depends on your motherboard chipset and BIOS.   No matter what, each process can only allocate about 2-3 GB of address space though.  The size of tmpfs might be limited as well.

I don't see the point of tmpfs in /var/tmp/portage anyway.  The kernel will already use all available RAM for disk caches anyway.  I doubt you'll see a big performance increase unless you have a real slow hard drive.  Also, using "-pipe" in your CFLAGS will help limit the I/O going on during compiles.

----------

## eccerr0r

I have two 32-bit installs with 4GB RAM - I don't notice much of a paging penalty using full PAE.  All 4G is accessable, granted not all to the same process.  All programs pretty much work as before, oblivious to the fact it's running in PAE mode.

Keep in mind that there are a lot of older/"consumer" chipsets that do not support more than 3.XX GB of RAM.  The two chipsets I have are P43 and G965, both of which I believe support at least 8GB (7GB..) RAM before they start complaining.  Both have Core2 6000 series chips in them.

The other option to using PAE, of course, is to use a 64-bit kernel (which does not get around chipset limitations).  Still thinking about doing it... just that 32-bit is working fine right now.

The only advantage to using tmpfs for /var/tmp/portage is that it saves write time to disk for temporary files, which is writeback cached anyway... I don't bother with tmpfs as it's basically interfering with the kernel's caching, it *still* needs to read/cache from disk as it fills /var/tmp/portage, which will clash with memory used to do the actual compile... though honestly I've never benchmarked this.

----------

## aCOSwt

1/ About PAE extension : WARNING : In order for device drivers to operate in such an environment, they must be compiled under a PAE system.

Which is not the case for the blobs found in many proprietary drivers.

=> Opting for PAE will prohibit the use of things such as nvidia-drivers...

2/ No 32bit system (apart from PAE) can fully use 4GB ram because 4GB is the maximum addressable space INCLUDING IO ports and PCI addressable space (~600M depending on hardware)

=> these overlapping areas would need to be remapped above 4G.

----------

## eccerr0r

 *aCOSwt wrote:*   

> 1/ About PAE extension : WARNING : In order for device drivers to operate in such an environment, they must be compiled under a PAE system.
> 
> Which is not the case for the blobs found in many proprietary drivers.
> 
> => Opting for PAE will prohibit the use of things such as nvidia-drivers...
> ...

 

Yes, device drivers would have be made aware that it's possible that io space could be mapped very strangely when PAE is enabled.  But it's a fairly common problem at this point.  ATI-Drivers, surprisingly enough, works fine under PAE on my system minus the normal ati-drivers issues.  I suspect Nvidia made sure it will work as well, because >2G RAM is not out of the norm anymore.

 *Quote:*   

> 2/ No 32bit system (apart from PAE) can fully use 4GB ram because 4GB is the maximum addressable space INCLUDING IO ports and PCI addressable space (~600M depending on hardware)
> 
> => these overlapping areas would need to be remapped above 4G.

 

Well, that's what PAE is for, so you can access above the 4G mark.  Remapping is not an issue as long as the chipset/firmware can do it correctly... what's virtual memory for in the first place?  It's remapping random blocks of memory back into a continuous address space regardless where it exists in physical memory.  Some can be above, some below, it doesn't matter.  It was for lazy programmers - so they can see a flat address space no matter where the OS/hardware decided to put the software in memory.

----------

## r3tep

On my desktop are 8 GB RAM on 32-bit with PAE.

As I read, this configuration allows the system to use 8 GB RAM but one 32-bit-process is only able to use 4 GB RAM (IMHO)

----------

## Shining Arcanine

Well, I just found out that my processor (Intel Yonah) does not support PAE, so it is a moot point.

I have a SSD, so it is a bit of an advantage for me to have stuff write to memory as opposed to writing to the disk. I guess I will just have to workaround the capacity of tmpfs for the cases that need more space (e.g. openoffice).

----------

## depontius

IIRC, if you plug in 4G in a 32-bit machine you should still get something like 3G-1M.  You lose that top 1M, but that's still nothing to sneeze about in terms of total memory.  Better than 2G.

----------

## aCOSwt

 *depontius wrote:*   

> IIRC, if you plug in 4G in a 32-bit machine you should still get something like 3G-1M.  You lose that top 1M, but that's still nothing to sneeze about in terms of total memory.  Better than 2G.

 

<joking>

Welllll... doing so... do you think I get some chance having something like a 48 bits system putting a 64 bit cpu on a 32 bit bus ?   :Wink: 

</joking>

More serioulsy many modern system allow having a total of 3G ram. No need to buy 4 to get 3.

BTW putting 4G, you could expect 3,4 - 3,6 G available depending on your hardware.

For having lost a considerable amount of time trying to make my programs fit in 8K...

Wasting 1/2G is something far above my understanding capabilies...   :Evil or Very Mad: 

----------

## PaulBredbury

 *aCOSwt wrote:*   

> putting 4G, you could expect 3,4 - 3,6 G

 

How does that square with my Acer 8930G laptop, which has 4G RAM and running 32-bit Linux with PAE:

```
$ free -m

             total       used       free     shared    buffers     cached

Mem:          4053       1060       2993          0         58        804

-/+ buffers/cache:        197       3855

Swap:            0          0          0

$ uname -a

Linux hiddenname 2.6.32-pf8 #1 SMP PREEMPT Tue Jan 19 12:08:59 ICT 2010 i686 pentium3 i386 GNU/Linux
```

And yes, I run nvidia's proprietary driver - its kernel interface gets compiled.

----------

## depontius

I think that was a typo.  I meant that you should be able to get about 4G - 1M.  I've never actually been in the situation, so I can't say from experience.  I've talked to others, and I thought the big issue was that BIOS typically maps the top of a 4G address space for I/O, ROM, and such.  The big issue for 64-bit machines is finding a BIOS that can move all of that stuff to the top of addressable memory instead of the top of commonly addressable memory.  This problem has plagued us ever since addresses were 16 bits.  (Even before the 8088-based IBMPC with a 20-bit address bus)

----------

## aCOSwt

 *PaulBredbury wrote:*   

> How does that square with my Acer 8930G laptop, which has 4G RAM and running 32-bit Linux with PAE:

 

Well... you get a PAE system. No problem for remapping above 4G. I was writing about 32bits non PAE. 

 *PaulBredbury wrote:*   

> And yes, I run nvidia's proprietary driver - its kernel interface gets compiled.

 

Well, sincerely happy to know that I am wrong ! Sorry for having told bs.

In Sept 2009, I unfortunately tried to implement v180 under a PAE - FreeBSD 6.4... to discover that... I had not carefully enough read the readme which was stating a non-compatibility with PAE systems. It seems things are progressing the right way. Maybe next month we can expect full 64 bit drivers...

Thank you Paul for this info.

----------

## Shining Arcanine

I thoguht that Nvidia already offered 64-bit Linux drivers. Is something wrong with the ones they provide?

----------

## aCOSwt

 *aCOSwt wrote:*   

> Maybe next month we can expect full 64 bit drivers...

 

 *Shining Arcanine wrote:*   

> I thoguht that Nvidia already offered 64-bit Linux drivers. Is something wrong with the ones they provide?

 

"we" improperly stood for FreeBSD.

nVidia only provides an x86 version of his driver for FreeBSD  :Evil or Very Mad: 

----------

## depontius

Does nouveau run on FreeBSD?

----------

## aCOSwt

 *depontius wrote:*   

> Does nouveau run on FreeBSD?

 

Well... still writing on Sept 2009 situation...   :Wink: 

- nv is running fair but with near to zero support for 3d acceleration

- nouveau... hmmm... I will keep as my opinion the qualifier : unstable !   :Wink: 

Many FreeBSD longrunners having widely expressed their own one : "useless piece of crap"   :Shocked: 

----------

## col

I recently upgrade my ram to 4G on a very old 32 bit install. All I did was recompile the kernel with 64G support. Reboot & everything has worked fine and free shows 4G.

----------

## depontius

 *col wrote:*   

> I recently upgrade my ram to 4G on a very old 32 bit install. All I did was recompile the kernel with 64G support. Reboot & everything has worked fine and free shows 4G.

 

Sounds to me like you're running a 64-bit kernel with a 32-bit userspace.  Nothing wrong with that, but it's not a full 64-bit system.  But with your amount of RAM, you're probably just fine the way things are.

Type "uname -m" and see what it says.

----------

## Monkeh

 *depontius wrote:*   

>  *col wrote:*   I recently upgrade my ram to 4G on a very old 32 bit install. All I did was recompile the kernel with 64G support. Reboot & everything has worked fine and free shows 4G. 
> 
> Sounds to me like you're running a 64-bit kernel with a 32-bit userspace.  Nothing wrong with that, but it's not a full 64-bit system.  But with your amount of RAM, you're probably just fine the way things are.
> 
> Type "uname -m" and see what it says.

 

Not unless he built a 64-bit toolchain first.. It's quite possible to use 4GB of RAM correctly on 32-bit installs..

----------

## depontius

Oops, he said 64G support, not 64-bit support.  Sounds like PAE.

----------

## Monkeh

 *depontius wrote:*   

> Oops, he said 64G support, not 64-bit support.  Sounds like PAE.

 

Sounds like? .... Is.

----------

## Cyker

I've steered away from PAE because everyone here says it slows down the system noticeably, but I've realized that a lot of other distros turn PAE on by default, even if you have <4GB RAM, just because you have to to enable the NX bit!

WinXPSP2 and upward all use PAE even tho' they can't access more than 4GB of RAM just so the NX bit can be used!

----------

## eccerr0r

I hear 5%-10% slowdown with PAE due to the page swaps but it really depends on the app.  If the app does not need to change to kernel pages or pages not available when banked, then you won't see as much hit.  I barely notice any interactive performance hit at all.

My computer does not feel noticeably slow with PAE enabled.  Besides, disk swapping is a bigger hit than bank swapping with PAE.

----------

