2

Let’s say we have a 32-bit address, so each bit can be either 1 or 0.

So the total number of combinations is equal to 2^32.

So we can represent 2^32 addresses (without unit).

But why do people say a 32-bit address can represent 2^32 byte addresses (why “byte” addresses)?

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

Won’t it become 2^32 * 8 bits addresses? Why can people simply add “byte” at the end?

Lypyrhythm
  • 324
  • 2
  • 13
runcode
  • 3,533
  • 9
  • 35
  • 52
  • 1
    You have 2^32 addressable units. Modern processors are byte-addressable, so you get 2^32 bytes. There are older processors whose addressable units are not bytes. For example the original machine for which UNIX was developed was word-addressable, so a 36-bit integer could access 2^36 words, not 2^36 bytes. – Raymond Chen Mar 11 '13 at 20:25
  • 1
    Does this answer your question? [How does 32-bit address 4GB if 2³² bits = 4 Billion bits not Bytes?](https://stackoverflow.com/questions/25820886/how-does-32-bit-address-4gb-if-2%c2%b3%c2%b2-bits-4-billion-bits-not-bytes) – phuclv Aug 04 '22 at 16:43

2 Answers2

6

Because memory is byte-addressable rather than bit-addressable.

The address 0x100 refers to a single byte and the address 0x101 refers the following byte.

Kyle Lutz
  • 7,966
  • 2
  • 20
  • 23
  • 1
    ok, i think i got it now, is that 2^32 is just representing the number of addresses, but in the OS, the basic UNIT is byte. so if we have 2^32 addressess, so we can represent 2^32 byte addresses? – runcode Mar 11 '13 at 18:32
  • say you had 4 bit address. each address would be one of 16 (2^4) values between 0 and 15 (inclusive). Each of those numbers (addresses) would refer to one of 16 *bytes* (not *bits*) in memory. so in this case you the memory size would be 16 bytes. if you had 32 bits you could have up to 2^32 bytes (or 4GB) of addressable memory. – Kyle Lutz Mar 11 '13 at 18:37
0

Each address points to a byte. In memory, it is not the single bits that are addressed but instead bytes.

So, 32bits will give you an addressable space of 2^32 items, each item being a full byte. Yes, it could have been made so that each address points to a specific bit, but no, they made each address point to a byte.

DanC
  • 8,595
  • 9
  • 42
  • 64