背后4GB的限制数学在32位系统 [英] Math behind 4GB limit on 32 bit systems

查看:206
本文介绍了背后4GB的限制数学在32位系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与32位内存地址的很基本的问题。我的理解是,2 ^ 32是可能的内存地址的32位系统上的最大数量。凡我很困惑就是我们如何从这个数字被指控的4GB的限制去。在我的研究,我所看到的一些人做到这一点:

I have a very fundamental question relating to 32 bit memory addresses. My understanding is that 2^32 is the maximum number of possible memory addresses on a 32 bit system. Where I am confused is how we go from this number to the alleged 4GB limit. In my research I have seen some people do this:

2 ^ 32 = 4,294,967,296字节

2^32 = 4,294,967,296 bytes

4,294,967,296 /(1,024 * 1024)个=〜4 GB

4,294,967,296 / (1,024 * 1,024) = ~4 GB

首先,哪里该(1,024 * 1024)个来自哪里?

First, where does this (1,024 * 1,024) come from?

二,纠正我,如果我错了,但4,294,967,296标记为字节,因为字节是可以在RAM中寻址存储空间的最小单位。由于我们仅限于2 ^ 32个地址,这是一个可以解决的字节数。

Second, correct me if I am wrong, but 4,294,967,296 is labeled as bytes because a byte is the smallest unit of storage space that can be addressed in RAM. Since we're limited to 2^32 addresses, that's the number of bytes that can be addressed.

第三,即使在RAM中的最小可寻址空间是一个字节,这必须不与硬盘驱动器的情况下,因为32位的系统通常具有硬盘的大大超过4GB的。有人可以简要描述为硬盘寻址方案?

Third, even though the smallest addressable space in RAM is a byte, this must not be the case with the hard-drive because 32 bit systems usually have hard disk's well in excess of 4 GB. Can someone briefly describe the addressing scheme for hard disks?

推荐答案

这是基本的算术的情况下:每字节寻址单位时间可寻址单元的数量等于寻址的字节数数

This is a case of basic arithmetics: Number of bytes per addressed unit times number of addressable units equals number of addressable bytes.

难的是,从哪里获取这些数字。下面是我对吧:

The hard part is, where to get those numbers from. Here is my take on it:

1 - 什么是千字节,兆字节,技嘉

1 - What is a Kilobyte, Megabyte, Gigabyte?


  • 对于RAM,有同意,一个技嘉1024兆字节,由每千字节1024的,每个都是1024字节。这源于一个事实,即1024是2 ^ 10,但足够接近1000历史使基洛preFIX

  • 存储,厂商几年前开始使用严格小数单位,一兆字节是百万字节(因为它使能力看起来更大的印刷精美的说明书)

此已导致1024 * 1024字节被称为一个MIB和1000 * 1000字节被称为一个MB的

This has led to 1024*1024 Bytes being called a MiB and 1000*1000 Bytes being called a MB

2 - 寻址单元


  • 有关的RAM,可寻址单元是字节,即使是从物理RAM取出在至少4
  • 的块
  • 大容量存储,可寻址的单位是扇区或块,其中大部分往往是512个字节,但4096字节快速赶上。

3 - 寻址单元的数量是要复杂得多,让我们开始与RAM:

3 - The number of addressable units is much more complicated, let's start with RAM:


  • 一个32位的CPU( SANS 的MMU!)可以解决2 ^ 32字节或4吉布

  • 所有现代的32位CPU包括MMU,这4吉布的虚拟地址空间映射到物理地址空间

  • 该物理地址空间使用MMU的函数更多(或$ p中$ phistoric倍以下)超过32的物理地址线可以有不同的尺寸比4吉布。当今最常见的实现是36或更多的物理位,产生16 * 4吉布以上(PAE或物理地址扩展)

  • 这MMU魔术确实的不可以工作CPU周围以32位模式运行,即对于每一个进程,地址空间不能超过4吉布
  • 较大
  • 要使事情更有趣,此地址空间的一部分用于内核功能,在每一个现代操作系统,我知道的。这导致2吉布或3吉布最大的可用每个进程地址空间中所有的主流操作系统。

  • 而因为这仍然是太简单:在一个模式,它可以实际使用的物理内存超过4吉布必须通过操作系统来支持运行MMU。一个显着的例子就是Windows XP中32位,这不允许。

  • 最后,但并非最不重要的:物理地址空间的一部分被最常用于内存映射的硬件。如果这是与OS的限制如上述相结合,其导致在Windows XP 32位有时能够使用仅2.5到物理RAM 3.5吉布

  • A 32 Bit CPU (sans the MMU!) can address 2^32 Bytes or 4 GiB
  • All modern 32 Bit CPUs include a MMU, that maps these 4 GiB of virtual address space into a physical address space
  • This physical address space can have a different size than 4 GiB, as a function of the MMU using more (or in prehistoric times less) than 32 physical address lines. Today's most common implementation are 36 or more physical Bits, resulting in 16*4 GiB or more (PAE or physical adress extension)
  • This MMU magic does not work around the CPU running in 32 Bit mode, i.e. for every process, the address space can't be larger than 4 GiB
  • To make things a little more interesting, a part of this address space is used for kernel functionality in every modern OS I know of. This results in 2 GiB or 3 GiB maximum usable address space per process for all mainstream OSes.
  • And as this still is much too simple: Running the MMU in a mode, where it can actually use more than 4 GiB of physical RAM must be supported by the OS. A remarkable example is Windows XP 32 Bit, which does NOT allow that.
  • And last but not least: A part of the physical address space is most often used for memory-mapping hardware. If this is combined with OS limits as above, it results in Windows XP 32 Bit sometimes being able to use only 2.5 to 3.5 GiB of physical RAM

这是少得多用于存储的麻烦:

It's much less of a hassle for storage:


  • 在所有现代的基于PC的情况下,我所知道的,可寻址单元只需用32或48位(或LBA逻辑块寻址)计数。即使是在它的最基本的版本,这是足以让每个磁盘的存储 2的TiB (每512字节的2 ^ 32块)。刷爆出的版本与48位LBA,并在大约每块4的结果昆明植物研究所每个磁盘的一个极大的TiB。

  • in all modern PC-based Cases I know of, the addressable units are simply counted with 32 or 48 Bits (LBA or logical block addressing). Even in it's most basic version this is enough for 2 TiB of storage per disk (2^32 blocks of 512 Bytes each). Maxed-out versions with 48 Bit LBA and 4 KiB per block result in ca. a Gazillion TiB per disk.

这篇关于背后4GB的限制数学在32位系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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