为什么32位处理器即使字长很大也只能寻址4GiB的内存? [英] Why 32-bit processor can only address 4GiB of memory, even with large word size?

查看:180
本文介绍了为什么32位处理器即使字长很大也只能寻址4GiB的内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到现在,我还认为32位处理器可以使用4 GiB的内存,因为2 32 是4 GiB,但是这种方法意味着处理器的字长= 1字节 >.因此,具有32位程序计数器的进程可以寻址2 32 个不同的存储字,因此我们有4个GiB.

Until now I thought that a 32-bit processor can use 4 GiB of memory because 232 is 4 GiB, but this approach means processor have word size = 1 byte. So a process with 32-bit program counter can address 232 different memory words and hence we have 4 GiB.

但是,如果处理器的字长大于1个字节,我相信现在大多数处理器都是这种情况(我的理解是,字长等于...数据总线,因此具有64位数据总线的处理器的字长= 8字节.

But if a processor has word size larger than 1 byte, which is the case with most of processors now days I believe (My understanding is that word size is equal to the width of data bus, so a processor with 64-bit data bus must have a word size = 8 bytes).

现在同一台具有32位程序计数器的处理器可以处理2 ^ 32个不同的存储字,但是在这种情况下,字长为8个字节,因此它可以处理更多的内存,这与4 GiB的内容矛盾我的论点有什么问题?

Now same processor with 32 bit Program counter can address 2^32 different memory words, but in this case word size is 8 bytes hence it can address more memory which contradicts with 4 GiB thing, so what is wrong in my argument ?

推荐答案

CPU(至少32位x86系列)必须能够访问4GB空间中的任何字节/字/双字.因此,对指令进行编码的方式是,目标字大小和存储地址(通常)属于不同的位域.因此,CPU访问字节还是dword都没有关系,但是编码的内存地址必须相同.

CPU (at least x86 family 32-bit) must be able to access any byte/word/dword in 4GB space. So an instruction is encoded such a way that target word size and memory address (usually) belong to different bit-fields. So it doesn't matter whether CPU accesses byte or dword, but the encoded memory address must be the same.

请注意,使用 PAE,技术上32位OS和x86 CPU能够占用超过4GB的地址空间. 模式.但是,例如,当前的Windows OS系列(服务器版本除外)不支持此功能.某些版本的WinXP以及Linux和其他32位操作系统可以在x86 CPU上寻址64GB的内存.

Note that 32-bit OS and x86 CPU technically is able to acccess more than 4GB address space using PAE mode. But it is not supported by, say, the current Windows OS family (except Server editions). Some versions of WinXP, as well as Linux and other 32-bit OS can address 64GB of memory on x86 CPU.

此外,通常OS会保留虚拟地址空间的某些部分(用于OS内核,视频内存等),因此用户程序在每个进程中可以使用的OS不能寻址的4 GB RAM中不超过3 GB的RAM.

Also, usually OS reserves some part of virtual address space (for OS kernel, Video memory etc.), so user programs may use, say, no more than 3 GB of RAM of the 4GB an OS can address within each process.

这篇关于为什么32位处理器即使字长很大也只能寻址4GiB的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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