A 4 gigabyte virtual address space is created per process, which is shared between the OS and the process. The OS decides the boundary (which is fixed for all processes).
The OS exists in every virtual address space.
IOW the "process [does have] its own 4GB of address space" but has to share it with the OS, and cannot read, write, or execute the part of virtual memory owned by the kernel.
If I am running 3 process on 32 bit windows which are designed with requirements 1 GB RAM each. Will there be memory allocation issue on a 2GB RAM system. If not, how does windows achieve this.?
A user process does not have the privilege of requiring physical memory that remains resident (i.e. cannot be swapped out).
Since virtual memory schemes use swapping (with a page file or swap space on a mass storage device), typically there are no issues running multiple processes of 4 GB virtual address space with physical memory less than than the virtual size.
It is possible to create an out-of-memory (aka OOM) condition if processes create large memory demands and there is not enough physical memory and swap space.
Does all the virtual address space of a process is allocated a physical address in physical memory or is it a lazy allocation where the mapping is only done when that virtual address is accessed?
There is never a requirement that an entire program must be allocated physical memory and loaded into memory.
The mapping of physical memory for a process is based on need.
A process only needs to be memory resident when it is actually being executed, and at a minimum regardless of its size, only the one page of code that is currently referenced by the program counter register and any pages of data references have to be actually resident.
So yes there is a "lazy allocation where the mapping is only done when that virtual address is accessed", aka demand paging.
If I am running 3 process on 32 bit windows which are designed with requirements 1 GB RAM each. Will there be memory allocation issue on a 2GB RAM system. If not, how does windows achieve this.? Does all the virtual address space of a process is allocated a physical address in physical memory or is it a lazy allocation where the mapping is only done when that virtual address is accessed? – Aman Yadav – 2018-07-26T02:45:29.780
2Please do not expand on your questions in comments; [edit] your question to make it clearer and more complete. – Scott – 2018-07-26T02:52:08.960