Quote:
Originally Posted by Yuc
So I just wonder how the system decides what virtual address space to give the new process when starts it.
|
The
virtual address space is what the linker (ld) compiled into the executable.
The
physical addresses (and it doesn't have to be a single space) is where the kernel can find room in the current RAM usage to load one or more pages OF the executable.
But that's invisible to the application itself.
PS: even malloc's will return virtual address values, that is, addresses that the program can use TO access the newly allocated memory. Again: the program doesn't need to know where in RAM this memory has been found.
The
physical address of a page may even vary during the execution of the program.