The virtual address space in Linux is also 0 ~ 4G. The Linux kernel divides the space of 4G bytes into two parts. The maximum 1 GB (from the virtual address 0xc0000000 to 0 xffffffff) is used by the kernel, which is called "kernel space ". The lower 3G bytes (from the virtual address 0x00000000 to 0 xbfffffff) are used by each process, called "user space ". Because each process can enter the kernel through a system call, the Linux kernel is shared by all processes in the system. Therefore, from the perspective of a specific process, each process can have 4 GB of virtual space.
It is important that the virtual address space is not the actual address space. The process address space is allocated, and 4G is only the maximum. Generally, the address space of a process is always less than 4 GB. You can view the/proc/Pid/maps file to learn the address space of a specific process. However, the address space of the process does not correspond to the actual physical page. Linux uses the lazy mechanism to allocate the actual physical page ("demand paging" and "and copy on write) to improve the actual memory usage. That is, each virtual memory page does not necessarily correspond to a physical page. The ing between a virtual page and a physical page is implemented through the ing mechanism, that is, the page table is mapped to the actual physical page. Because each process has its own page table, the same virtual address of different processes can be mapped to different physical pages, this makes it possible for different processes to have 4 GB of virtual address space at the same time.