In the below link, answer given by Sdaz MacSkibbons gives a brief overview of process address space on virtual address systems.
What happens when a computer program runs?
Now suppose every process gets 4GB virtual address space. Now does that mean that the top addresses of this virtual address space will get stack part (Suppose stack address starts from 0) and address space from bottom will be allocated to text, data, globals and heap. Since size of heap changes, do new malloc allocations will map virtual address space pages to real memory directly or do they check whether previously allocated virtual address pages to heap are free/available. And How about if we need large amount of heap memory, like greater than 4GB, than how do process supports that ?
Thanks in advance.