TONT 38233 时常被误解的 /3GB 选项

包治百病。

原文链接:https://devblogs.microsoft.com/oldnewthing/20040805-00/?p=38233

It’s simple to explain what it does, but people often misunderstand.

解释这个选项“是什么”很容易,但人们又误解它的含义。

The /3GB switch changes the way the 4GB virtual address space is split up. Instead of splitting it as 2GB of user mode virtual address space and 2GB of kernel mode virtual address space, the split is 3GB of user mode virtual address space and 1GB of kernel mode virtual address space.

/3GB 选项使得 4GB 虚拟地址空间的划分方式发生了变化。原来是划分为 2GB 的用户模式虚拟地址空间和 2GB 的内核模式虚拟地址空间,启用后则变成了 3GB 用户模式虚拟地址空间和 1GB 内核模式虚拟地址空间。

That’s all.

仅此而已。

And yet people think it does more than that.

然而人们却仍然想太多。

I think the problem is that people think that “virtual address space” means something other than just “virtual address space”.

我认为,问题可能出在人们认为『虚拟地址空间』这个说法有其字面含义之外的东西。

The term “address space” refers to how a numerical value (known as an “address”) is interpreted when it is used to access some type of resource. There is a physical address space; each address in the physical address space refers to a byte in a memory chip somewhere. (Note for pedants: Yes, it’s actually spread out over several memory chips, but that’s not important here.) There is an I/O address space; each address in the I/O address space allows the CPU to communicate with a hardware device.

术语『地址空间』指的是当存取某种类型的资源时,一个数字值(即所谓『地址』)是如何被对应解释的。一种地址空间被称作物理地址空间,每个物理地址空间中的『地址』都指向在内存芯片中的某个字节。(致读死书者:没错,这个地址的确是囊括了多块内存芯片的范围,不过在这里这不是重点。)还有一种叫I/O地址空间,其中的地址使得CPU得以与某个硬件设备进行通讯。

And then there is the virtual address space. When people say “address space”, they usually mean “virtual address space”.

再来就是虚拟地址空间了。当人们提及『地址空间』时,通常指的就是『虚拟地址空间』。

The virtual address space is the set of possible pointer values (addresses) that can be used at a single moment by the processor. In other words, if you have an address like 0x12345678, the virtual address space determines what you get if you try to access that memory. The contents of the virtual address space changes over time, for example, as you allocate and free memory. It also varies based on context: each process has its own virtual address space.

虚拟地址空间是在某一时刻处理器可以使用的一组可能的指针值(地址)。换句话说,如果你有一个类似0x12345678这样的地址,那么如果试图访问这个地址的内存的话,是由虚拟地址空间来决定你获取到的内容的。虚拟地址空间的内容随时间不断变化,例如,每当分配和释放内存时(都会发生变化)。依据场景不同,虚拟地址空间的所指也会发生变化,每个进程都有其自己的虚拟地址空间。

Saying that 2GB (or 3GB) of virtual address space is available to user mode means that at any given moment in time, out of the 4 billion virtual addresses available in a 32-bit value, 2 billion (or 3 billion) of them are potentially usable by user-mode code.

有2GB(或3GB)虚拟地址空间对用户模式可用这个说法,意味着在任何给定的时刻,在32位值、共40亿的虚拟地址中,有20亿(或30亿)的地址对用户模式的代码是潜在可用的。

Over the next few entries, I’ll talk about the various consequences and misinterpretations of the /3GB switch.

在接下来的几篇文章中,我将讨论有关人们对/3GB选项的不同拓展解释,以及由此引发的误解。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

 剩余字数 ( Characters available )

Your comment will be available after auditing.
您的评论将在通过审核后显示。

Please DO NOT add any links in your comment, otherwise it would be identified as SPAM automatically and never be audited.
请不要在评论中插入任何链接,否则将被自动归类为垃圾评论,且永远不会被提交给博主进行复审。

*