How exactly a process uses virtual address space? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

How exactly a process uses virtual address space?

I have read that every process works on it's own Private address space where it assumes it has been allocated the whole of primary block.How exactly do the mapping from logical to primary address happen?

20th Apr 2017, 4:11 AM
Ravish Mallya
Ravish Mallya - avatar
1 Answer
This is handled by the operating systems' page file system. When an application is started it is assigned a block of memory, a pid, a priority flag, etc. This information all goes to the page file. Addressing your question (no pun intended), the operating system knows the starting address of the program (0xABC123) but the program itself doesn't care where it resides in physical memory as it will assume a "virtual" starting address of 0x0. .NET actually allows you to ping the Windows OS to get page file information and increase is allotted size, assign a different priority, etc. I believe g++ also allows the same functionality from a Linux OS, where the file system is AKA the swap partition. Edit: something didn't sit right with me in my answer. The process doesn't really assume a starting address 0x0 - in "dumbing" down my answer that statement could be misleading.
25th Apr 2017, 7:01 PM
Mason Krei
Mason Krei - avatar