Why does a 32-bit OS support 4 GB of RAM?

前端 未结 13 2004
不知归路
不知归路 2020-12-08 04:18

Just reading some notes in a purdue lecture about OSs, and it says:

A program sees memory as an array of bytes that goes from address 0 to 2^32-1 (0

相关标签:
13条回答
  • 2020-12-08 04:49

    4 GB = 2^32 bytes. But remember its max 4gb allocated by a 32 bit OS. In reality, the OS will see less e.g. after VRAM allocation.

    0 讨论(0)
  • 2020-12-08 04:50

    Because 32 bits are able to represent numbers up to 232 − 1 = 4294967295 = 4 GiB − 1 and therefore address up to 232 individual bytes which would be 4 GiB then.

    There are ways to circumvent that, though. For example using PAE even a 32-bit operating system can support more memory. Historically this has most commonly been used on servers, though. Also, the non-server Windows SKUs don't support it. By now all that is moot, though, given that 64-bit CPUs, OSes and driver support are commonplace.

    0 讨论(0)
  • 2020-12-08 04:53

    Everybody is saying 2^32 = 4GiB, which is right. Just in case, here is how we got there:

    A 32-bit machine uses 32 bits to address memory. Each bit has a value of 0 or 1. If you have 1 bit, you have two possible addresses: 0 or 1. A two-bit system ( pun aside ) has four possible address: 00 =0, 01=1, 10=2, 11=3. 2^2=4. Three bits have 8 possble addresses: 000=0, 001=1, 010=2, 011=3, 100=4, 101=5, 110=6, and 111=7.

    Each bit doubles the potential address space, which is why 2^n tells you how many addresses you use for a given number of bits. 2^1 = 2, 2^2 = 2*2 = 4, 2^3 = 2*2*2 = 8, etc.

    By the time you get to 32 bits, you are at 4GiB.

    0 讨论(0)
  • 2020-12-08 04:55

    4 GB = 2^32 bytes.

    0 讨论(0)
  • 2020-12-08 05:05

    Actually, it's not as simple as 2^32 = 4294967296 bytes. You see in x86 protected mode, with paging enabled (that is, what you get when you use any modern OS), you don't address memory locations directly, even though the paging translation mechanism is transparent for client applications.

    Of a logical 32 bit memory address, when using 4K pages:

    • bits 22-31 refer to a page directory
    • bits 12-21 refer to a page table
    • bits 11-0 refer to an offset in the 4096 byte page

    As you can see, you have 2^10 (1024) page directories, in each page directory, you have 2^10 page tables and each page is 2^12 (4096) bytes long, hence 2^32 = 4294967296 bytes. The width of the memory bus is conveniently the same as the word length of the CPU but it's not necessary to be like this at all. In fact, more modern x86 CPUs support PAE which enables addressing more than 4GB (or GiB) even in 32-bit mode.

    0 讨论(0)
  • 2020-12-08 05:06

    If you have a 4-bit system, this means the address for each byte is 4 binary digits, the probability of all your address will range from 0000 through 1111 which is 2^4 = 16 (2 because there is either 0 or 1), with four bits it's possible to create 16 different values of zeros and ones, If you have 16 different addr. each represent a byte then you can have a max of 16 bytes

    4-bit system will look like this:

    For a 32-bit system, your max is 2^32 = 4294967292 bytes

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