Size of a Word and addressing
Asked Answered
B

2

11

I was refreshing myself on memory information and I am confused on the size of a Word. From my understanding, a Word is not a universally defined size, but is a size defined by the specific system (in terms of number of bytes).

According to wikipedia:

Hence, a processor with 32-bit memory addresses can directly access 4 GiB of byte-addressable memory.

Does that mean that a 32-bit processor can address 4,294,967,295 Words? 32-bit windows is limited to 4GB of RAM, but reading over the meaning of a word had me wondering. Does each Word in windows equate to 1 byte? Could the size of a word just be a larger number of bytes and a 32-bit processor be able to address 8GB, 10GB, 12GB or even more memory?

Brocket answered 31/3, 2013 at 23:3 Comment(4)
Read again what you quoted. It says 4GiB of **byte-addressable** memory, meaning just that: bytes. Not words, or DWORDS, but byte.Insusceptible
If I remember correctly, word size is determined by the CPU, and the processor's word size is determined by the width of its external data bus (though it can be narrower.)Antiar
@KenWhite Hence my confusion. Thats why I am posting. Why is it bytes and not words. I guess thats why you downvoted me?Brocket
@Justin: I didn't downvote you. If I had, I would have said so in my last comment. However, the reason for your confusion is unclear. Your question asks "Does that mean...$,294,967,295 Words?", which is what I commented on. Your question in your comment to me says "Why is it bytes and not words?" which is something totally different. The answer to the question you asked is "No, it does not mean Words. It means bytes, just like your quote says it does.".Insusceptible
T
11

Does that mean that a 32-bit processor can address 4,294,967,295 Words?

It depends on the CPU and on how you look at it.

There are CPUs that can't address anything smaller than a word. 16-bit Texas Instruments Digital Signal Processors are a good example. Their C/C++ char (AKA byte), short and int types are all of the same size, 16 bits. And that is the smallest unit of memory that can be addressed with a unique address (pointer) and that's the machine word at the same time. Since data addresses/pointers are 16-bit on these processors, they can address at most 216 16-bit words in the data memory.

Now, if you go back to x86 CPUs in 32-bit modes of operation, things are a little different. The smallest addressable unit of memory is an 8-bit byte and the largest is a 32-bit word (machine word). Addresses and pointers are 32-bit as well (if we ignore segmentation and page translation). This lets us have 232 unique memory addresses. And, trivially, with them you can access up to 232 8-bit bytes of memory. But how many 32-bit words can you address with 232 unique addresses? The answer depends on whether you want non-overlapping or overlapping words. You see, the x86 CPU can access 32-bit units of memory at any address, not just at addresses that are multiple of 4 bytes.

You aren't just limited to this on x86:

  0 1 2 3 4 5 6 7  <- address
  \word/  \word/

These all are all valid addresses for 32-bit word accesses on x86:

  0 1 2 3 4 5 6 7  <- address
  \word/  | | | |
    \word/  / | |
      \word/  / |
        \word/  /
          \word/
            ...

So, how many 32-bit words can you address with 232 unique addresses on x86? If you're talking about all uniquely addressable and overlapping ones, that's 232 of them. If, OTOH, you're talking about all uniquely addressable and non-overlapping ones, that's 230 of them.

OTOH, if your 32-bit CPU uses non-32-bit addresses, the total count will be different.

Thrawn answered 1/4, 2013 at 1:47 Comment(4)
Hey there and sorry for invoking this thread. May i ask you how many left logical swift would it require for you to read on single character, since 1 shift moves 2 positions, 2 shifts moves 4 and 3 moves 8? Can you do 0 logical shift? thanksHobard
@Hobard I'm not sure what you're talking about.Thrawn
Excellent answer ! Thank you. I find the that second ascii drawing rather confusing, but the text is smooth and clear :)Assurgent
Just a pointer for other surfers, there is an excellent video explanation to this topic here.Assurgent
A
3

You are confusing word size and byte size, because word size is determined by the processor and byte size is universal.

Without using PAE (Physical Address Extension) a 32-bit processor can only handle 4GB of RAM since there are only 2 ^ 32 = 4,294,967,296 different numbers that can be represented using 32 bits. This is a hardware limitation.

32-bit systems utilizing PAE can address more than 4GB, by mapping processes to page tables. This grants each process access to 4GB of memory. Via supporting PAE, the 32-bit version of Windows Server 2003 Datacenter supports up to 64 GB of RAM on x86-based computers.

Edit

Word size denotes the amount of bits a CPU can process at one time. So 32 bits = 4 bytes. However, word size and address size are often used interchangeably which leads to confusion, since they are indeed different. The Pentium Pro was a 32-bit CPU with a 36-bit wide address bus, allowing 64GB of accessible memory (via PAE.)

Antiar answered 31/3, 2013 at 23:43 Comment(3)
So does that mean at each address there is 1 byte? I don't understand why an address could be a block of say, 6 bytes. Then you could have 4,294,967,296 * 6 mappable RAM.Brocket
@Brocket Also to elaborate a bit more, a CPU capable of accomplishing the question in your comment specifically would require a 48-bit address bus. Which I believe is what current 64-bit processors use.Antiar
@Brocket Sorry for invoking this question from 2013. Anyways to answer your question While each adress has 8 bit space = 1 byte in order to save there data depends on what you want to save. If you want to save a character you will need 1 byte but if you want to store an Int you would need 32 bits = 4 bytes so 4 adresses "space". The 32 bit proccessor reads 4 bytes each time hence 32 bitsHobard

© 2022 - 2024 — McMap. All rights reserved.