使用分段的 32 位 x86 的 64 TB 虚拟内存:如何实现?
Intel x86 内存模型具有分段和分页功能。系统可以寻址高达 64 TB 的虚拟内存,这意味着什么?我的理解是只有4GB的虚拟内存是可寻址的。这里的差距是什么?这都是在 32 位处理器的上下文中
,数学如下:
2^13(段选择器)* 2(LDT 或 GDT)* 2^32 = 2^46 = 64 TB。这在文献中称为总虚拟内存。他们是否错误地将其称为虚拟内存?让我困惑的是,处理器本身只有 32 位地址线。
或者,他们是否想说这是可以分配的总虚拟内存(跨所有进程?)
Intel x86 memory model has segmentation and paging. What does it mean that the system can address upto 64 terabytes of virtual memory. My understanding is that only 4GB of virtual memory is addressable. What is the gap here? This is all in the context of 32 bit processor
Here is the math:
2^13 (segments selectors) * 2 (LDT or GDT) * 2^32 = 2^46 = 64 Terabytes. This is referred to in the literature as total virtual memory. Are they wrongly terming it virtual memory? What confuses me is, the processor itself has only 32 bit address lines.
Or, are they trying to say that this is the total virtual memory that can be allocated total (across all processes?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1) 段描述符是由段选择器从 2^13*2=2^14 中选择的,段选择器位于单独的寄存器中,因此它绕过了 32 个地址线的限制。
2)段描述符包含一个段的32位地址,它是一个32位值。向其中添加 32 位偏移量是一个简单的算术加法,因此您最终会得到一个 32 位地址。仅 2^32=4GB。
问题是,这些部分可能会重叠。您的数学错误实际上是当前段描述符的索引(14 位)和偏移量(32 位)没有连接。它们经过处理形成 32 位线性地址。
请查看此页面,了解有关 x86 内存分段的更多信息。
1) the segment descriptor is chosen out of these 2^13*2=2^14 by a segment selector, which is in a separate register, so it bypasses the 32-address-line limitation.
2) the segment descriptor contains the 32-bit address of a segment, which is a 32-bit value. Adding the 32-bit offset to it is a simple arithmetic addition, so you end up with a 32-bit address. 2^32=4GB only.
The thing is, the segments may overlap. The mistake in your math is in the fact the index of the current segment descriptor (14 bits) and the offset (32 bits) are not concatenated. They are processed to form a 32-bit linear address.
Check out this page for more information about x86 memory segmentation.
它实际上是可用的——您可以将内存交换到磁盘,并在需要时实际寻址那么多虚拟内存,因此数字应该是正确的,您确实可以将其称为虚拟内存。
然而,32 位模式下的 x86 处理器在不进行交换的情况下一次只能寻址 4 GB,而且我听说过的任何系统都不会在 32 位模式下使用那么多内存,而且通常不太实用由于性能。
It would actually be usable – you can swap memory to disk and actually address that much virtual memory if need be, so the figures should be correct, and you can call it virtual memory indeed.
However, an x86 processor in 32 bit mode would only be able to address 4 GB at once without swapping, and no system I've heard of ever used that much memory while in 32-bit mode, and it would usually not be very practical due to performance.
我认为这里所说的是 x86 处理器能够寻址到那么多内存,但实际上并不是这样。只有当程序使用分段内存模型并同时利用完整段和 GP 寄存器并且 CPU 以这种方式连接使用它们时,这才有可能。然而,当今的程序通常使用平面内存模型(可以寻址更少的内存),并且操作系统不支持寻址那么多内存。
以及手册的第 3.3.1 节[1]:
显然,它们能够寻址 246 (64 TiB) 字节(虚拟和物理?)内存但是我们仅限于使用的内存模型程序以及操作系统是否支持它。
I think what is being said here that the x86 processor is capable of addressing up to that much memory, not that it does in practice. That would only be possible if the program used the segmented memory model and utilized both a full segment and GP register and the CPU's were wired use them in that way. However, programs today typically use the flat memory model (which can address less memory) and operating systems does not support addressing that much memory AFAIK.
And from §3.3.1 of the manual [1]:
So apparently they are wired to be able to address 246 (64 TiB) bytes of (virtual and physical?) memory but we are confined to what memory model is used in the programs and whether the operating system supports it.