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.

It is well known that 32-bit systems can only handle 4 GB as maximum amount of RAM.

Under Linux, does this limit also apply to swap partitions? If my RAM + swap exceeds 4 GB, will it be fully used?

If the answer is "no, it doesn't apply to swap", why?

share|improve this question
This physical memory limitation statement is not true across all platforms... "Physical Address Extension (PAE) is a feature to allow 32-bit x86 central processing units (CPUs) to access a physical address space (including random access memory and memory mapped devices) larger than 4 gigabytes." en.wikipedia.org/wiki/Physical_Address_Extension –  packets May 8 '13 at 11:17
@packets Don't confuse him any more. He really needs to go and learn about fundamental concepts like virtual addressing and paging first. –  David Marshall May 8 '13 at 12:23
No problems, I'm not afraid of learning. –  Sekhemty May 8 '13 at 18:51
add comment

2 Answers

up vote 10 down vote accepted

No, Imagine RAM is like your desk, and swap space/ virtual memory is like a filing cabinet. You can put lots of information into a filing cabinet, but it's difficult to access. Any papers you want to use, you have to pull out and put them on the desk; the problem is the desk can only hold so many papers at once.

32-bit machines can only have a desk that's 4GB (2^32, or about 4 billion bytes) big, but they can still have nearly unlimited filing cabinets. They just have to "swap" out papers when the desk is full and they need to look at another page that's in a filing cabinet.

The reason it doesn't apply to swap is because accessing the contents of RAM or executing code from it is limited to the size of the numbers that it can work with. Think of it like you can only have 4 billion words on the desk, because that's as high as you can count, and you need to work directly with words. "Word 3,547 is mispelled. Change word 3,452,780 to 'Hello'. Delete word 6."

Now, each page might have 4,000 words on it. The catch is when you're referencing swap space, you don't reference it by word, only by page. So you can still only count to 4 billion, but you can count to 4 billion pages. 4 billion pages actually holds 16 trillion words - much, much higher than you can count.

64-bit machines can just count higher, so they can put all the pages on the desk at once, if they have a large enough desk. Even if you put a super-large desk in a 32-bit machine, you can still only count to 4 billion, so you have no way to reference all the extra words on the desk.

share|improve this answer
So, what are you trying to tell me is that the swap space acts as an index for RAM memory? And, consequently, a single GB of swap represent much more memory than a single GB of RAM? Anyway, I still can't understand why the system can't manage more than 4GB of RAM, but instead can with swap. Why aren't we all using swap instead of RAM then? –  Sekhemty May 7 '13 at 22:52
Swap space is like "unloaded" memory, and it is referenced in much larger chunks. 1GB of RAM is 1GB of swap, but RAM is addressed per byte and swap is addressed per chunk. A different example might be to think about packing peanuts. How many packing peanuts can you hold in your hands? Maybe 100 before trying to pick up more causes some to pop out between your fingers? Now, how many packing peanuts can you hold if we put them into boxes? Thousands? Swap is kinda like the boxes. You can manage data in larger chunks, but you can't access the data itself. –  Darth Android May 8 '13 at 0:09
@Sekhemty: To your second question on why we are using swap all the time - The swap file exists on your hard disk and the speed at which the computer can access data on the hard disk is dependent on the access speed of the disk (and then some). But even the fastest hard disks are much much slower than physical RAM. So its a question of speed. Also current x86 architecture does not allow this anyway (no RAM; only swap). The Swap file is an OS concept that the system has no awareness of. –  Bobby Alexander May 8 '13 at 0:59
@DarthAndroid: thanks, it's clear now. –  Sekhemty May 8 '13 at 18:50
add comment

You are confusing physical and virtual memory.

The RAM is physical memory. The swap space can contain many 4GB virtual address spaces.

share|improve this answer
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.