32-bit Linux single process has 4 GB memory limit-Linux general technology-Linux programming and kernel information. The following is a detailed description. Use the following code to test how much user-mode memory the system can allocate to a single process:
1 # include
2 # include
3
4 int main (){
5 int MB = 0;
6 while (malloc (1 <20) + + MB;
7 printf ("Allocated % d MB total. n", MB );
8}
This code is executed on a 32-bit system and returns 3066 M. When executed on a 64-bit system, the system will eventually become overloaded, and then the kernel will kill the process. This indicates that a single process on a 32-bit system has a memory allocation limit, while a 64-bit system does not.
When compiling a 32-bit Linux kernel, open the PAE addressing support for the Linux kernel. The maximum supported memory can be increased from 32-bit to 36-bit (4G-> 64G ), the memory that can be allocated by a single process is still limited to 4 GB. That is, for each process, the user State can allocate up to 3 GB memory, and the core State can allocate up to 1 GB memory.
So can we dynamically adjust the kernel parameters so that 32-bit Linux kernel supports a single process with more than 4 GB memory? This is a practical issue. Squid, Mysql, and Java are all single-process applications. Many mainstream servers can be configured with very high memory. For example, Dell 6850 and HP580 support 16 GB of memory. I have seen a Sun server that even supports 48 gb of memory. If these large memory machines run a single process application, the memory will be wasted.
I checked some information and concluded that 32-bit BSD can dynamically adjust kernel parameters to support large memory allocation by a single process,
The 32-bit linux system cannot solve the 4G memory limit of a single process.
The following is an excerpt from High Memory in the Linux Kernel:
This is enabled via the PAE (Physical Address Extension) extension of the PentiumPro processors. PAE addresses the 4 GB physical memory limitation and is seen as Intel's answer to AMD 64-bit and AMD x86-64. PAE allows processors to access physical memory up to 64 GB (36 bits of address bus ). however, since the virtual address space is just 32 bits wide, each process can't grow beyond 4 GB.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.