This guide is to explain how Ubuntu handles 4 or more gigabytes of memory and the options you have for utilizing all your memory.
By default, the 32bit versions of Ubuntu support up to 4GB of memory however, in practice, if you have 4GB of memory, you will generally only see somewhere between 3GB and 3.5GB. The reason for this is that various devices on your computer need large chunks of the memory address space to work properly and so the system maps them into the highest parts of memory. When that happens on a machine with 4GB of memory and a 32bit kernel, it limits the amount addressable physical memory.
The options you have for running Ubuntu with 4G+ of memory are:
1) Use a 64bit version of Ubuntu
If your machine supports it, the easiest way to make use of 4GB+ of memory on Ubuntu is to simply use a 64bit version of Ubuntu which can inherently handle large amounts of memory. For some motherboards, you may have to enable a feature called "Map around memory hole" in the BIOS for this to work (it may be called something different depending on the BIOS however, it should be named something similar to this).
- Requires no extra setup
- No inherent performance hit for using 4GB+ of RAM
- Not supported on all hardware
- Not all software/drivers may be supported for 64bit versions of Ubuntu. However, this is far less of an issue than it used to be and most users will have no problems whatsoever running 64bit.
2) Use a PAE enabled kernel
PAE is a way to allow a 32bit kernel to address up to 36bits of memory (64GB). The kernel documentation says that there is a slight performance hit when using PAE however, in practice, you are not likely to notice any difference in performance. The default Ubuntu kernel does not have PAE enabled however, there are two ways to get a PAE enabled kernel:
2.1) Ubuntu server kernel
The Ubuntu server kernel has PAE enabled and can be installed by doing:
After the server kernel has been installed, you can select it from the grub boot menu.Code:sudo apt-get install linux-server linux-headers-server linux-restricted-modules-server
- Easy to setup and maintain on an existing 32bit install
- Works on machines that cannot use a 64bit version of Ubuntu but support 4GB+ of RAM.
- The server kernel is not optimized for desktop usage (see link above). However, depending on how you use your machine you may not notice any difference.
- There can be issues with third party drivers and the server kernel (specifically, nvidia drivers).
2.2) Build a PAE enabled kernel
It's very easy to enable PAE in a custom compiled kernel. From "make menuconfig", the option to enable it is:
There are many guides to building a kernel for an Ubuntu machine:Code:-> Processor type and features -> High Memory Support -> 64GB
- https://help.ubuntu.com/community/Kernel/Compile (from Ubuntu source)
- Better desktop performance than the Ubuntu server kernel
- Building a custom kernel helps you learn about the system
- Building a custom kernel can be difficult and time consuming.
- You may have to manually install some drivers for your hardware.
- By not using an Ubuntu kernel, you become responsible for keeping your kernel up to date with security patches.
3) Do nothing
If your machine is not capable of running a 64bit version of Ubuntu, the performance of the server kernel isn't to your liking and you aren't willing to build a custom kernel, your last option is to simply do nothing. This will limit you to around 3GB to 3.5GB of memory however, it shouldn't cause any system instability or problems.