windows - 当它可以访问的总内存也被限制为4GB时,Windows如何为多个进程每个分配4GB地址空间

标签 windows memory-management process operating-system virtual-address-space

How does Windows give 4GB address space each to multiple processes when the total memory it can access is also limited to 4GB.

我在Windows内存管理中找到了上述问题的解决方案 (作者:Pankaj Garg)

解决方案:

To achieve this Windows uses a feature of x86 processor (386 and above) known as paging. Paging allows the software to use a different memory address (known as logical address) than the physical memory address. The Processor’ paging unit translates this logical address to the physicals address transparently. This allows every process in the system to have its own 4GB logical address space.

任何人都可以帮助我以更简单的形式理解它吗?

最佳答案

基本思想是您的物理 RAM 有限。一旦它填满,您就开始将内容存储在硬盘上。当进程请求当前在磁盘上的数据或请求新内存时,您可以通过将页面传输到磁盘来从 RAM 中踢出一个页面,然后调入您实际需要的数据。

操作系统维护一个名为page table的数据结构。跟踪哪些逻辑地址对应于当前物理内存中的数据以及磁盘上的内容。

每个进程都有自己的虚拟地址空间,并使用该空间内的逻辑地址进行操作。操作系统负责将对给定进程和逻辑地址的请求转换为磁盘上的物理地址/位置。它还负责防止进程访问属于其他进程的内存。

当进程请求当前不在物理内存中的数据时,page fault被触发。发生这种情况时,操作系统会选择一个页面移动到磁盘(如果物理内存已满)。有几个page replacement algorithms用于选择要踢出的页面。

关于windows - 当它可以访问的总内存也被限制为4GB时,Windows如何为多个进程每个分配4GB地址空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12445369/

相关文章:

windows - 如何将 Linux wxWidgets 应用程序移植到 Windows + Mac

ios - 内存管理 iOS 开发应用程序在一些细节项目后不起作用

linux - Ubuntu Server 中的两个或多个事件进程

windows - 如何在 VB6 中执行更多代码之前等待 shell 进程完成

qt - QProcess::close() 是否会在进程上引发 unix SIGTERM 信号?

c - 使用 MINGW 强制 C 将 stdin 读取为二进制

windows - 跨子文件夹运行批处理脚本(递归)

windows - 如何运行带有详细输出的 PowerShell 脚本?

python - 从 SWIG 类型映射中释放内存

c# - WCF - 使用 "DataSet"通过 NetTcpBinding 传输数据好吗