为什么操作系统不能使用整个 64 位进行寻址?为什么只有 48 位? [英] Why can't OS use entire 64-bits for addressing? Why only the 48-bits?

查看:47
本文介绍了为什么操作系统不能使用整个 64 位进行寻址?为什么只有 48 位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读了解 Linux 内核".

I'm reading "Understanding Linux Kernel".

64 位架构的分页

正如我们在前面看到的部分,通常采用两级分页由 32 位微处理器使用.然而,两级分页不是适用于采用64 位架构.让我们用一个解释原因的思想实验:

As we have seen in the previous sections, two-level paging is commonly used by 32-bit microprocessors. Two-level paging, however, is not suitable for computers that adopt a 64-bit architecture. Let's use a thought experiment to explain why:

首先假设标准页面大小4 KB.因为 1 KB 涵盖了一个范围210 个地址,4 KB 覆盖 212地址,因此 Offset 字段为 12位.这留下了多达 52 位的要分配的线性地址表和目录之间领域.如果我们现在决定使用64 位中只有 48 位用于寻址(这个限制给我们留下了一个舒适的 256 TB 地址空间!),剩余的 48-12 = 36 位将必须在 Table 和目录字段.如果我们现在决定为这两个中的每一个保留 18 位字段,页面目录和每个进程的页表应该包括 218 个条目,即超过256,000 个条目.

Start by assuming a standard page size of 4 KB. Because 1 KB covers a range of 210 addresses, 4 KB covers 212 addresses, so the Offset field is 12 bits. This leaves up to 52 bits of the linear address to be distributed between the Table and the Directory fields. If we now decide to use only 48 of the 64 bits for addressing (this restriction leaves us with a comfortable 256 TB address space!), the remaining 48-12 = 36 bits will have to be split among Table and the Directory fields. If we now decide to reserve 18 bits for each of these two fields, both the Page Directory and the Page Tables of each process should include 218 entries that is, more than 256,000 entries.

  1. 如果我们现在决定只使用 64 位中的 48 位进行寻址".为什么?&为什么只有 48 位?为什么不是其他数字?

  1. "If we now decide to use only 48 of the 64 bits for addressing". Why? & Why only 48 bits? Why not some other number?

好吧,我只是一个普通的 PC 用户 &程序员.对我来说很难相信每个进程的 32 位寻址,即 4GB(2GB/3GB 更正确)地址空间是一个限制.如果您真的遇到了这个限制.请举个例子.

Well, I'm just a regular PC user & programmer. Its just hard to believe for me that 32-bit addressing i.e. 4GB (2GB/3GB to be more correct) address space per process is a limit. If you really encountered this limit. Please give me example.

windows 的这个限制是多少?

What is this limit for windows?

我知道虚拟内存 != 物理内存 &处理器地址引脚与虚拟内存无关.这是一个完全不同的问题.如何知道处理器的地址引脚数(= 地址总线的大小).http://ark.intel.com 处理器规格不包含此规格.

I know that virtual memory != physical memory & processor address pins have nothing to do with virtual memory. This is a completely different question. How to know the number of address pins (= size of address bus) for a processor. http://ark.intel.com specifications of a processor doesn't include this spec.

答案:

Paul Betts 的回答 对第一个问题的合理回答.

See Paul Betts's answer for reasonable answer for 1st question.

推荐答案

如果我们现在决定只使用 64 位中的 48 位进行寻址".为什么?&为什么只有48位?为什么不是其他数字?

"If we now decide to use only 48 of the 64 bits for addressing". Why? & Why only 48bits? Why not some other number?

系统架构师进行权衡.256TB 似乎足以容纳 1 个进程的地址空间.记住虚拟地址!=物理地址,一般来说,每个进程都有自己的地址空间.

System architects make tradeoffs. 256TB seems like more than enough room for 1 process's address space. Remember virtual address != physical address, and generally speaking, each process has its own address space.

只要指针是 64 位的,这就是一个性能问题,而不是其他任何问题.如果 &当 48 位成为限制时,可以调整操作系统以使用更多位的 64 位地址空间,而不会破坏应用程序的不兼容性.目前,建筑师们只是为自己争取了一段非常舒适的时间.

As long as pointers are 64 bits, this is more of a performance capability issue than anything else. If & when 48 bits becomes a limitation, the OS could be tweaked to use more bits of the 64-bit address space without breaking application incompatibility. For now, the architects are just buying themselves a very comfortable amount of time.

这可能与处理器端的虚拟寻址能力有关,因为现在许多处理器都有内存管理单元 处理虚拟 -> 物理内存映射.

It may have to do with processor-side virtual addressing capabilities, as many processors now have memory management units to handle the virtual -> physical memory mapping.

如何知道处理器的地址引脚数(= 地址总线的大小).http://ark.intel.com 处理器规格不包含此规格.

How to know the number of address pins (= size of address bus) for a processor. http://ark.intel.com specifications of a processor doesn't include this spec.

这在很大程度上是无关紧要的.这是处理器实现各种物理寻址方案的一种方式.如果总线是同步的并且地址位及时复用,则 64 位处理器可以为其完整的地址空间实现外部地址/数据总线,包括 64、32、16、8、4、2 或 1 个地址引脚.同样,虚拟地址!= 物理地址;64 位虚拟寻址可以用 48 位或 32 位物理地址来实现(只是你将被限制为 248 或 232 个字的内存).

This is for the most part irrelevant. It's a way for a processor to implement various physical addressing schemes. A 64-bit processor could achieve external address/data buses for its complete address space with 64, 32, 16, 8, 4, 2, or 1 address pin if the bus is synchronous and the address bits get multiplexed in time. Again, virtual address != physical address; 64-bit virtual addressing could be implemented with 48-bit or 32-bit physical addresses (just that you would be limited to 248 or 232 words of memory).

更新:如果您真的想知道,您必须查看相关处理器的数据表.例如.Intel Core 2 Duo -- 数据表的第 4.2 节讨论了信号——地址总线是 36 位宽(但实际上是 33 条信号线;数据宽度是 64 位 = 8 字节,因此其他 3 条线可能在正确数据对齐的情况下是不必要的)

update: if you really want to know, you have to look at the datasheet of each processor in question. E.g. Intel Core 2 Duo -- section 4.2 of the datasheet talks about the signals -- the address bus is 36-bits wide (but is really 33 signal lines; the data width is 64-bit = 8 bytes so the other 3 lines are probably unnecessary with proper data alignment)

好吧,我只是一个普通的 PC 用户 &程序员.对我来说很难相信 32 位寻址,即每个进程 4GB(2GB/3GB 更正确)地址空间是一个限制.如果你真的遇到了这个限制.请举个例子.

Well, I'm just a regular PC user & programmer. Its just hard to believe for me that 32-bit addressing ie.. 4GB (2GB/3GB to be more correct) address space per process is a limit. If you really encountered this limit. Please give me example.

两个字:内存映射文件.

这篇关于为什么操作系统不能使用整个 64 位进行寻址?为什么只有 48 位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆