虚拟内存大小
我在 Windows XP 上将虚拟内存大小设置为 756 MB。但在 msdn 上阅读时,它说 32 位操作系统上每个进程的虚拟内存默认为 4 GB。它与我设置的虚拟内存大小有何不同?
**Memory** **range** **Usage**
Low 2GB (0x00000000 through 0x7FFFFFFF) Used by the process.
High 2GB (0x80000000 through 0xFFFFFFFF) Used by the system.
另外,每个进程的范围如何相同?
I have virtual memory size set to 756 MB on windows xp. but when reading on msdn it says virtual memory for each process on 32 bit OS is 4 GB by default. how it is different from the size of virtual memory that i set?
**Memory** **range** **Usage**
Low 2GB (0x00000000 through 0x7FFFFFFF) Used by the process.
High 2GB (0x80000000 through 0xFFFFFFFF) Used by the system.
also, how is the range is same for each process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的页面文件设置为 756 Mb。页面文件就像额外的 RAM,但由磁盘支持。
然而,虚拟内存是不同的,而且有点复杂。
每个进程都有 4 Gb 的地址空间。这是 32 位指针的范围,因此效果很好。其中一半保留给内核(操作系统),并且在每个进程中都是相同的。另一半用于流程本身,并且是该流程所独有的。
当进程请求时,操作系统将“页面”分配给内存的私有部分。这些页面在进程的地址空间中获得一个槽,这与它们在物理 RAM 中的位置完全无关。事实上,如果当前没有使用它们,它们甚至可能不在 RAM 中。如果操作系统需要一些物理 RAM 来替换其他内容,则会将页面“交换”到页面文件。
需要记住的重要一点是,您的进程中的地址 0x10000 与另一个进程中的 0x10000 完全不同。
幸运的是,操作系统可以处理所有这些事情,因此您不必这样做。
Your page file is set to 756 Mb. The page file is like extra RAM, but backed by the disk.
Virtual Memory, however, is different, and kind of complex.
Every process gets an address space of 4 Gb. This is the range of a 32-bit pointer, so that' works out nicely. Half of that is reserved for the Kernel (Operating System), and is the same in every process. The other half is for the process itself, and is unique to that process.
The operating system allocates "pages" to the private portion of memory as the process asks for it. The pages get a slot in the process's address space which has nothing at all to do with where they are in physical RAM. In fact, they may not even be in RAM if they're not currently being used. The operating system will "swap" pages out to the page file if it wants some physical RAM for something else.
An important thing to remember is that address 0x10000 in your process is totally different from 0x10000 in another process.
Fortunately, the operating system juggles all this around so you don't have to.
这是一个太大的主题,无法在此处的答案中充分涵盖。您几乎肯定需要读一本书(我推荐杰弗里·里希特(Jeffrey Richter)针对此类主题的书籍)。
4 Gb 是关于地址空间。 756 Mb 用于后备存储。
很多东西(尤其是可执行文件的内容)使用地址空间而不使用后备存储。当您执行一个程序时,该程序的可执行文件(及其使用的所有 DLL)都会映射到地址空间。然后,根据需要,逐页地将可执行文件的各个部分放入物理内存中。
756 Mb 是用于“扩展”RAM 空间的额外存储空间——但这通常仅用于数据,而不是代码;代码已经存储在可执行文件中,因此系统在需要时直接从可执行文件中读取数据。 756 Mb 主要用于您在计算机运行时创建或修改的数据(尽管“修改/创建”的定义可能很模糊——例如,您加载的网页内容将包括在内)因为你让它进入内存,即使你根本没有创建它或改变它)。
This is way too big a subject to cover adequately in an answer here. You almost certainly need to read a book (I recommend Jeffrey Richter's books for this kind of subject matter).
The 4 Gb is about address space. The 756 Mb is about backing store.
Quite a few things (especially the contents of executable files) use address space without using backing storage. When you execute a program, the executable file for that program (and all the DLLs it uses) are mapped to address space. Then, on a page-by-page basis, pieces of that executable are brought into physical memory as needed.
The 756 Mb is extra storage to "extend" the RAM space -- but this is normally used only for data, not code; code is already stored in the executable file, so the system reads the data directly from the executable file when it's needed. The 756 Mb is used primarily for data you've created or modified as the computer is running (though the definition of "modified/created" can be fuzzy -- for example, the contents of a web page you've loaded would be included because you caused it to come into memory, even though you didn't create it or change it at all).
Windows中的虚拟内存设置仅影响虚拟内存分页文件的大小,而不影响分配给进程的虚拟内存的总大小。
The virtual memory setting in windows only affect the size of the virtual memory paging file, not the total size of virtual memory allocated to processes.