Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I understand correctly, a 32-bit OS (Ubuntu) can only address 4GiB memory, so RAM with size larger than 4Gib will only be used 4Gib of itself and the rest is a waste.

I am now confused about this situation for RAM with similar one for virtual memory and for swap.

  1. with virtual memory being swap + RAM, if the size of the virtual memory exceeds 4Gib, will the exceeding part be a waste for the 32-bit OS?
  2. if I now have to choose the size for my swap partition, is it a factor to consider that the 32-bit OS can only address 4GiB memory? Does the size of swap have to be chosen with respect to the 4Gib addressible limitation? Will the swap exceeding 4GiB always be a waste?

  3. is virtual memory equal to RAM and swap? or can virtual memory use space on the hard drive outside the swap partition?

Thanks and regards!

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

The 32-bitness of the CPU only applies towards process memory and physical memory; the OS maintains its own CPU-independent structures for mapping the swap to the various processes. As much swap as the OS can handle can be used regardless of the bit depth of the CPU.

Strictly speaking, "virtual memory" is the space a process can access. Some of it can be mapped to either swap or storage via mmap(2).

share|improve this answer
Thanks, Ignacio! What is the difference between the bit depth of the CPU and the bit depth of the OS? Do they have to agree with each other? Can a 32-bit OS be installed with a 64-bit CPU? –  Tim Jan 2 '11 at 2:43
There's actually three bit depths you need to worry about: the CPU, the OS, and the program. For X86-64, they can come in 64/64/64, 64/64/32, and 64/32/32. Other 64-bit architectures are a little less forgiving, requiring a 64-bit OS even though they can use 32-bit programs. –  Ignacio Vazquez-Abrams Jan 2 '11 at 2:56
Thanks again! I happened to find at tldp.org/HOWTO/Partition/requirements.html :"the maximum size of a swap partition is architecture-dependent. For i386, it is "officially" 2Gb. It is 128Gb on alpha, 1Gb on sparc, and 3Tb on sparc64. An opteron on the 2.6 kernel can write to a 16 Tb swap partition. " Does it mean the size of the swap is limited by the bit-depths of both CPU and OS? –  Tim Jan 2 '11 at 20:47
add comment

Swap does not fail to handle post-4GB addresses, that limitation applies to mapping physical memory, even in a 32-bit environment (it's not addressed in the same way).

As for the amount of swap, there is a common myth that it should be twice as large as your physical RAM size, that's simply not really needed -- swap was much more of a critical component back in the days when 512MB RAM was the standard, but nowadays it has much more of a "back seat" function, if you want to call it that. If you use hibernate you should make sure that you have at least physical RAM + a bit more (maybe an excess of 512MB if you want to be cautious).

With that said, better safe than sorry. If you have the space free, considering using a moderately sized swap size (maybe 1.5x your physical).

share|improve this answer
Thanks! Why are these numbers "an excess of 512MB" or "1.5x your physical"? Which of the two is to follow? –  Tim Jan 2 '11 at 20:50
Well, you're unlikely to get performance issues from having too large of a swap size, so it's better to go with whichever of those is larger, if that's not inconvenient. –  Matthieu Cartier Jan 3 '11 at 11:06
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.