虚拟地址中的内存映射 Space(VAS)
Memory mapping in Virtual Address Space(VAS)
这个关于虚拟内存的 [wiki article] 说:
The process then starts executing bytes in the exe file. However, the
only way the process can use or set '-' values in its VAS is to ask
the OS to map them to bytes from a file. A common way to use VAS
memory in this way is to map it to the page file.
图表如下:
0 4GB
VAS |---vvvvvvv----vvvvvv---vvvv----vv---v----vvv--|
mapping ||||||| |||||| |||| || | |||
file bytes app.exe kernel user system_page_file
我没看懂 values in its VAS is to ask the OS to map them to bytes from a file.
这里的系统页面文件是什么?
首先,我无法想象维基百科中会存在如此糟糕的文章。在能够理解所描述的内容之前,必须是已经熟悉该主题的专家。
假设您理解本文的其余部分,“-”部分表示进程可用的 4GB 地址 space 中未分配的虚拟地址。因此,句子“进程可以在其 VAS 中使用或设置 '-' 值的唯一方法是要求 OS 将它们映射到文件 中的字节”意味着分配虚拟内存地址,例如在调用 VirtualAlloc() 的 Windows 本机程序中,或调用 malloc() 以分配一些内存来存储程序数据的 C 程序中,而这些内存尚不存在于当前进程的虚拟地址中 space.
当Windows分配内存给进程地址space时,它通常将这些内存与硬盘中的分页文件相关联。 c:\pagefile.sys就是这个分页文件,也就是文中提到的system_page_file。当没有足够的物理页面来满足需求时,内存页面被换出到该文件。
希望澄清
这个关于虚拟内存的 [wiki article] 说:
The process then starts executing bytes in the exe file. However, the only way the process can use or set '-' values in its VAS is to ask the OS to map them to bytes from a file. A common way to use VAS memory in this way is to map it to the page file.
图表如下:
0 4GB
VAS |---vvvvvvv----vvvvvv---vvvv----vv---v----vvv--|
mapping ||||||| |||||| |||| || | |||
file bytes app.exe kernel user system_page_file
我没看懂 values in its VAS is to ask the OS to map them to bytes from a file.
这里的系统页面文件是什么?
首先,我无法想象维基百科中会存在如此糟糕的文章。在能够理解所描述的内容之前,必须是已经熟悉该主题的专家。
假设您理解本文的其余部分,“-”部分表示进程可用的 4GB 地址 space 中未分配的虚拟地址。因此,句子“进程可以在其 VAS 中使用或设置 '-' 值的唯一方法是要求 OS 将它们映射到文件 中的字节”意味着分配虚拟内存地址,例如在调用 VirtualAlloc() 的 Windows 本机程序中,或调用 malloc() 以分配一些内存来存储程序数据的 C 程序中,而这些内存尚不存在于当前进程的虚拟地址中 space.
当Windows分配内存给进程地址space时,它通常将这些内存与硬盘中的分页文件相关联。 c:\pagefile.sys就是这个分页文件,也就是文中提到的system_page_file。当没有足够的物理页面来满足需求时,内存页面被换出到该文件。
希望澄清