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?
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.