[windows]: something about the mapping between elf and vas
I read something from wiki about Virtual Address Sp开发者_运维问答ace (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?
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).
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.
精彩评论