0

I read something from wiki about Virtual Address Space (VAS).

One thing I don't understand, I'm not sure whether I understand it correctly. Here is it:

the application's EXE file is mapped into the VAS. Addresses in the process VAS are mapped to bytes in the exe file. The OS manages the mapping:

           0                                            4GB
VAS        |---vvvvvvv------------------------------------|
mapping        |-----|
file bytes     app.exe

My stupid question is what does it mean by 'mapped into the VAS'? Does it mean the exe file will be loaded into the physical mem?

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
Alcott
  • 17,905
  • 32
  • 116
  • 173

2 Answers2

1

The VAS, as it names implies, is a virtual space, so it doesn't need to be related to a physical one. That's up to the memory manager where to load it (physical memory or virtual memory or whatever).

m0skit0
  • 25,268
  • 11
  • 79
  • 127
  • then how do vas and physical mem relate? – Alcott Aug 17 '11 at 13:12
  • @Alcott what do you mean by relate? – Rowland Shaw Aug 17 '11 at 15:14
  • I mean, the exe file is mapped into its vas. My question is will the vas mapped to the physical mem? – Alcott Aug 17 '11 at 23:33
  • 1
    As I already said, the VAS doesn't have to be mapped entirely on physical mem. Some parts may be mapped, some not. Some parts can be on RAM, some empty (thus not used at all), some in swap... it depends on how much physical memory the machine has, and the memory manager swapping policy. This situation is of course flexibile and might change as needed. For example if the process is not running, the whole VAS could be on swap memory if current running process needs a lot of memory. All this is handled by the memory manager, which differs depending on the OS. – m0skit0 Aug 18 '11 at 07:47
0

Each process has its own address space, and the operating system manages the mapping between the virtual address space and the physical address of that page of memory (which at some points in time could be on disk, or it could be in RAM).

The operating system is there to handle when a process requests a read from its virtual address space, where that page really resides on disk (this is when a page fault occurs). Similarly, on a computer running with little free memory, this is why the disk can appear to thrash as the operating system struggles to swap pages between disk and physical memory.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166