LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   64-bit Linux OS and 32-bit application (http://www.linuxquestions.org/questions/linux-software-2/64-bit-linux-os-and-32-bit-application-784973/)

bvramesh 01-26-2010 10:31 PM

64-bit Linux OS and 32-bit application
 
Hi,

If we have 64-bit Linux OS and 32-bit application running on a board which has 30 GB RAM, it is for sure that the OS can access the whole 30 GB RAM. But, the question is can the 32-bit application access the whole 30 GB RAM or only 4 GB of RAM? I guess only 4 GB. Could any one of you have a quick answer and the theory behind the answer?

Thanks & Regards,
Ramesh.

paulsm4 01-26-2010 11:28 PM

You guessed it.

As far as the 32-bit application is concerned, it's running on a 32-bit machine with a 32-bit address space. End of story :)

johnsfine 01-27-2010 07:44 AM

Quote:

Originally Posted by bvramesh (Post 3841795)
But, the question is can the 32-bit application access the whole 30 GB RAM or only 4 GB of RAM? I guess only 4 GB.

A 32 bit application can use any 4GB out of the 30GB that the kernel happens to give it.

I wasn't sure what your question meant. For example, the 32 bit application is not limited to running in the first 4GB of physical memory.

Each 32 bit process in a 64 bit OS is limited to 4GB of virtual address space. You could run the same 32 bit program simultaneously in 8 different processes and use up to a total of 32GB of virtual memory. But any one of them is limited to 4GB.

There are tricks with remapping shared memory segments by which some (but very few) 32 bit programs make effective use of more than 4GB physical memory to operate on more than 4GB of in-memory data in a single process. But generally if you want to operate on more than 4GB of data in memory, you want to compile for 64 bit mode.

Quote:

Originally Posted by paulsm4 (Post 3841831)
As far as the 32-bit application is concerned, it's running on a 32-bit machine with a 32-bit address space. End of story :)

It isn't that bad nor that simple. The 32 bit application may have just 32 bit virtual address space, but that still gives it more than it would have "running on a 32-bit machine". For example: Since the kernel is 64 bit, the kernel can have the entire process address space mapped when servicing that process without that requirement reducing the process address size. So 32 bit user mode gets a full 4GB in a 64 bit OS but only 3GB in a typical 32 bit Linux.


All times are GMT -5. The time now is 06:32 PM.