0

Just to make sure, does every single address contain one byte? So say you had theoretical addresses FFF0 and FFFF: there are 16 values between these two addresses, which means between them they contain 16 bytes, or 8 x 16 bits? Every individual address is linked to a single byte?

thatguylowjwj
  • 39
  • 1
  • 1
  • 9

2 Answers2

0

Just to make sure, does every single address contain one byte?

...which means between them they contain 16 bytes, or 8 x 16 bits?

Every individual address is linked to a single byte?

Yes to all three questions.

Which is why the limitation with 32-bit addressing, you can only access 2^32 bytes == 4,294,967,296 bytes == 4 GiB. Each addressable memory location gives access to 1 byte.

If we could access 2 bytes with one address, then that limit would have been 8 GiB. And the architecture of modern chips and all software would have to be modified to determine whether they want both bytes or just the first or the second. So you'd need, say, 1 more bit to determine that. Guess what, if you had 33-bit machines, that's what we'd get...max address-able space of 8 GiB. Which is still effectively 1-byte-containing addresses. Workarounds do exist but that's not related to your questions.

* GiB = Binary GigaBytes.

Note that this is not related to "types" where a char is 1 byte and an int is 4 bytes. Programming languages compensate for that when trying to access the value of a stored variable/data stored at a location(s). And they are actually calculated as total bits rather than total bytes. So an int is considered as 32 bits rather than 4 bytes. When C fetches an int's value from memory, it will fetch all 4 bytes even though the address of the int refers to just one, the address of the first byte.

Community
  • 1
  • 1
aneroid
  • 11,031
  • 3
  • 33
  • 54
  • 1
    Thank you very much, I thought this might be a stupid question to ask, but your note about programming types at the end helped a lot too. – thatguylowjwj Dec 18 '15 at 04:43
  • Yup, that's why I added it. In context of programming, it changes how we think of "addressing 1 byte" vs "addressing one thing". – aneroid Dec 18 '15 at 04:46
0

Yes. Addresses map to bytes 1 to 1, even if they expect you to work with a word size of two or four bytes at a time.

Andrew Williamson
  • 6,465
  • 2
  • 30
  • 48