All we need is an easy explanation of the problem, so here it is.
What I understand about 32-bit OS is, the address is expressed in 32 bits, so at most the OS could use 232 = 4G memory space — I assume the unit is bytes, so 4GB.
Does this mean if any machine with a 32-bit OS (be it Windows or Unix) has more than 4GB total of RAM + page file on hard disk, for example 8GB RAM and 20GB page file, its memory will never be “used up”?
By “used up” I mean that increasing RAM or page file won’t help the performance; of course, it’s always possible an application will keep requesting memory from the OS but failing.
Similarly, if this 32-bit OS machine has 2GB RAM and 2GB page file, increasing the page file size won’t help the performance. Is this true?
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
What I understand about 32-bit OS is, the address is expressed in 32 bits, so at most the OS could use 2^32 = 4GB memory space
The most that the process can address is 4GB. You are potentially confusing memory with address space. A process can have more memory than address space. That is perfectly legal and quite common in video processing and other memory intensive applications. A process can be allocated dozens of GB of memory and swap it into and out of the address space at will. Only 2 GB can go into the user address space at a time.
If you have a four-car garage at your house, you can still own fifty cars. You just can’t keep them all in your garage. You have to have auxiliary storage somewhere else to store at least 46 of them; which cars you keep in your garage and which ones you keep in the parking lot down the street is up to you.
Does this mean any 32-bit OS, be it Windows or unix, if the machine has RAM + page file on hard disk more than 4GB, for example 8GB RAM and 20GB page file, there will never be “memory used up”?
Absolutely it does not mean that. A single process could use more memory than that! Again the amount of memory a process uses is almost completely unrelated to the amount of virtual address space a process uses. Just like the number of cars you keep in your garage is completely unrelated to the number of cars you own.
Moreover, two processes can share non-private memory pages. If twenty processes all load the same DLL, the processes all share the memory pages for that code. They don’t share virtual memory address space, they share memory.
My point, in case it is not clear, is that you should stop thinking of memory and address space as the same thing, because they’re not the same thing at all.
if this 32-bit OS machine has 2GB RAM and 2GB page file, increasing the page file size won’t help the performance. Is this true?
You have fifty cars and a four-car garage, and a 100 car parking lot down the street. You increase the size of the parking lot to 200 spots. Do any of your cars get faster as a result of you now having 150 extra parking spaces instead of 50 extra parking spaces?
It is true that the CPU can only address maximum 4Gb of RAM. However, current CPU’s use an MMU (Memory management unit) to translate process-specific memory addresses into physical memory addresses.
This MMU is used for all sorts of different tricks, from memory isolation (process A cannot manipulate memory of process B) to memory sharing (process A can access the same physical memory region as process B and can exchange data this way).
Although 32-bit CPU’s only support 4Gb of memory per process, it can address up to 64Gb of RAM when using Physical Address Extension. This allows process A to use the first 4Gb of memory, while process B uses the next 4Gb. In total, more than 4Gb of physical memory is used, but the total amount of memory a single process uses is still capped at 4Gb.
PAE is supported on Linux since kernel version 2.3.23 and on some 32-bit flavours of Windows Server, but not on 32-bit Windows XP, Vista or 7.
If your CPU does not support PAE you will be limited to 4GB of physical memory (or less depending on other factors).
Please note your operating system can still evict parts of physical memory to the disk (page file) regardless of the CPU supporting PAE. This ensures you can start multiple processes who use more than 4Gb combined. The only impact PAE has is whether you can keep the 4Gb of process B in physical memory while running process A.
Speaking specifically about 32-bit Windows variants, they have had support for more than 4GB of RAM since Windows 2003 variants (and you can also get a kernel hack for Windows 7 to allow you to use all of your RAM in 32-bit). However, this comes at a cost, as you outlined in the first part of your question.
In a 32-bit operating system, the size of a pointer (memory address) is the same as the word length of the CPU, 32-bits, which allows (as you mentioned) a 2^32 = 4GB memory space. Windows also takes a “virtual memory” approach for applications, so each application has it’s own memory space.
Since each pointer is only 32-bits wide, each application‘s pointers can only address up to 4GB of memory, even though the system can support more then 4GB of RAM. As far as I know, this is the only caveat to using more than 4GB of RAM in a 32-bit operating system. In total, you can have many applications using more than 4GB of RAM combined, but any one particular process can only allocate/access up to 4GB.
Back to your question, let’s say you have a program that uses 2GB of RAM. If you have 10 instances of this program, that’s 20GB. All 8GB of your RAM will be used up, as well as another 12GB of the pagefile. So yes, under 32-bit operating systems, it is more than possible to use up this memory.
if this 32-bit OS machine has 2GB RAM and 2GB page file, increasing
the page file size won’t help the performance. is this true?
Increasing the pagefile size will usually not increase performance (unless your RAM and pagefile are set to the absolute minimum, or set so low your computer constantly thrashes). It will, however, prevent your computer from running out of (virtual) memory. Whenever anything needs to be purged to the pagefile, you’re already taking a huge performance hit (since the hard drive is orders of magnitude slower then your RAM).
When a processor is said to be 32-bit, it means it can operate with 32-bit numbers using a single instruction. This has little to do with the width of its address bus, which on Intel architecture is 36-bit since Pentium Pro released in 1995.
The famous 4GB limitation comes from the fact that most PC software uses Flat memory model where each byte of memory can be addressed by a pointer. Since a pointer should fit in a register to be used, and registers are 32-bits wide, you’re limited to 4GB.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂