Why can't OS use entire 64-bits for addressing? Why only the 48-bits?

前端 未结 7 2261
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 09:33

I\'m reading \"Understanding Linux Kernel\".

Paging for 64-bit Architectures

As we have seen in the previous sections,

相关标签:
7条回答
  • 2020-12-14 10:16

    From a hardware prespective, another consideration is alignment.

    Once you need a data type of more than 4 bytes, say 6, you need to put them on 8-byte boundries to retrieve them in a single instruction. If you don't align you need to do bit masking and shifting, and add checks for this in the (assembly) code.

    Many people were annoyed at the switch to 64-bit that their programs consumed so much more memory. They would have wanted 48-bit pointers, and if the restrictions on alignment weren't there the CPU makers probably would have made a 48-bit architecture.

    Note that if you are so starved for memory that you want your pointers to be 6 bytes there are ways to do that. But there is a penalty to execution time.

    0 讨论(0)
提交回复
热议问题