简体   繁体   English

关于RAM,架构的指针大小

[英]pointers size with respect to RAM, architecture

there were many questions what determines size of a pointer. 是什么决定了指针的大小。 basically as a rule of thumb you can say this is processor architecture, 基本上作为一个经验法则,你可以说这是处理器架构,

x86 -> 4 bytes pointer x86 - > 4个字节的指针

x64 -> 8 bytes pointer x64 - > 8字节指针

I have seen also that some people here say it is system bus that is responsible for it, but other denied. 我也看到有人说这是系统总线负责,但其他人否认。 Let's say architecture tells me what is the size of a pointer. 假设架构告诉我指针的大小是多少。

To address 4GB of RAM you need 4,294,967,296 mappings and pointer of size 4 bytes can address 4,294,967,296 memory locations. 要解决4GB的RAM需要4,294,967,296个映射,大小为4个字节的指针可以处理4,294,967,296个内存位置。

To address 8GB of RAM you need 8,589,934,592 mappings and pointer of size 4 bytes cannot address all possible values. 要解决8GB的RAM,需要8,589,934,592个映射,大小为4个字节的指针不能解决所有可能的值。 so this is why I cannot have more than 4GB RAM on x86 architecture? 这就是为什么我在x86架构上不能有超过4GB的内存?

Amount of RAM is not limited by the architecture (32 or 64 bit). RAM的数量不受架构(32或64位)的限制。 Architecture only decides how much memory can be addressed at a time , by the OS and the programs running on it. 架构只决定操作系统和运行在其上的程序一次可以处理多少内存。 On a 32-bit machine, that is, a machine with 32-bit wide memory bus, the OS and the programs can "see" only 4 GB of memory. 在32位计算机上,即具有32位宽内存总线的计算机上,操作系统和程序只能“看到”4 GB的内存。 But that doesn't mean there is only 4 GB of RAM. 但这并不意味着只有4 GB的RAM。 If the manufacturer has provided for it, you can have 16 GB or 4x4 GB of RAM. 如果制造商已提供,则可以使用16 GB或4x4 GB的RAM。 In that case, there will be 2 more "hidden" address lines and also there'd be hardcoded logic to decide the levels of those 2 lines, thus selecting any of the available 4 GB RAMs - 00 01 10 11 . 在这种情况下,将有2个“隐藏”地址线,并且还有硬编码逻辑来决定这2行的电平,从而选择任何可用的4 GB RAM - 00 01 10 11 These "hidden" address bits are not used by the software layers, so for these layers, they can only use a 4-byte pointer. 这些“隐藏”地址位不被软件层使用,因此对于这些层,它们只能使用4字节指针。 The number of these "hidden" address lines decides by how much you can extend your RAM. 这些“隐藏”地址行的数量决定了您可以扩展RAM的程度。

This is just one example. 这只是一个例子。 It depends on the vendor, how they decide to provide for the extra RAM. 这取决于供应商,他们如何决定提供额外的RAM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM