1

I'm wondering whether 4 GB implies "Gigabit" or "Gigabyte" with respect to the 32-Bit OS addressing "only 4GB of address space"?

Other posts mention 2^32 Bit equal to 4294967296 bytes. But if they talk about 32 Bit, how come the result is given in Bytes?

Or am I missing something?

2

4 Answers 4

10

On most, if not actually all, current widely used architectures, memory addressing is done in bytes.

A 32-bit address width allows you to specify 232 (about 4.3 billion) addresses.

This means that a CPU that uses 32-bit addressing and addresses RAM in terms of bytes can natively address 232 bytes, which equals 4 GiB (gibibytes) or 4,294,967,296 bytes.

On many current architectures, there are other issues to consider, such as memory request address alignment, which limits what addresses can be used for actual access. But that does not change how much RAM the CPU can address, it only changes how it can be addressed, and unless you are working very close to the CPU this is normally abstracted away from the programmer, and certainly from the user.

It's also worth keeping in mind that the "bitness" of the CPU doesn't necessarily refer to the address width of the CPU, but rather normally refers to the CPU's native word size. Take the Intel 8088, as used in the original IBM PC, and its sibling the 8086; it had a 16 bit word size, but a 20 bit address width, and was typically referred to as a 16-bit CPU despite the fact that the 8088 only had an 8-bit data bus width (the 8086 had a 16-bit data bus). The Intel 80386SX had a 32-bit native word size but a 24-bit usable address width; the 80386DX had a full 32-bit address width. The Motorola 68000, roughly contemporary with the 8086/8088, had a 24-bit address width, but was a hybrid 16/32 bit design. And so on. The native word size may be the same as the address width, but it does not have to be.

There are ways (such as Physical Address Extension, PAE) to get around the 4 GiB limitation normally imposed by a 32-bit address width, just as CPUs with 16-bit addresses used various techniques (including segmentation and bank switching) to be able to address more than 64 KiB (216 bytes) of RAM. Also, if the addressing was done in a different unit (for example, 16-bit words rather than 8-bit bytes) then the actual amount of memory that could be addressed would change accordingly; as an example, by addressing 16-bit words rather than 8-bit bytes, a 32-bit address width would allow addressing 8 GiB because each address actually addresses two bytes.

2
  • 3
    this speaks to the question pretty directly. It is like having an apartment building with more apartments than mailboxes. The address space is the set of mailboxes, the bytes are the apartments. The size of the apartments has little to do with the number of mailboxes.
    – horatio
    Jan 10, 2014 at 19:22
  • @horatio very good analogy! It would be perfect if every apartment was the same size in a building.
    – Cruncher
    Jan 10, 2014 at 19:45
0

Each byte has a memory address, so the 32 bit address bus can be used to access 4 gigabyte of memory.

The amount of memory that you can address is the possible values of the address bus (2^32) times the size of each memory unit (1 byte), so 2^32 * 1 byte = 4294967296 bytes.

You could also express that as bits if you like, i.e. 2^32 * 8 bits = 34359738368 bits.

The unit that you express the result in, is the same unit as you express the memory unit in. The possible number of addresses doesn't have a unit, so while the address bus is 32 bits, the number of possible addresses isn't 4294967296 bits, it's just 4294967296.

If you for example had a 16 bit address bus, and each memory unit would be 4 bytes, you could access 2^16 * 4 bytes = 262144 bytes.

0

4GB refers to 4 Gigabytes and the 32-bit in the OS is not related in that way to the numbers.

It is not counted in bits, it is counted in bytes when using 2^32. But this limitation is not due to one thing and can vary depending on different I/O configurations on the mobo so it can vary greatly from 2 Gigabytes to close to 4 Gigabytes. And with PAE this can be overcome.

4
  • "GB" or "gb" are entirely different things. Your answer also fails to mention why "this is not due to one thing" or why memory is counted in bytes, which is the cause of confusion for the OP in the first place.
    – slhck
    Jan 10, 2014 at 10:52
  • Why they are counted in bytes is because it used to be that one char represented one byte = 8 bits = 8 values which are true or false. And gb or GB refer to Gigabyte in general and I was lax with refering to it.
    – Rasmus
    Jan 10, 2014 at 11:02
  • "gb" does not refer to Gigabyte in general. IEEE 1541 specifies the lowercase "b" for Bit. I'm just suggesting to be a bit more precise, especially when the OP is confused about exactly that part. You can edit your answer to improve it, of course.
    – slhck
    Jan 10, 2014 at 11:06
  • You are right, I was being unspecific.
    – Rasmus
    Jan 10, 2014 at 18:34
0

Try a small scale example to understand the concept.

If you have 2 bits(binary digits), you can store 2^2 numbers, that's 4 numbers. 00,01,10,11

So if you want to reference four apples, each one can be associated with a number.

So similarly, 32 bits, lets you store 2^32 ~= 4 thousand million numbers('cos 32=20+10+2 so 2^32=2^20+2^10+2^2), and 4 thousand million is 4 billion or 4 Giga, so that's 4 Giga objects. In this case, memory locations, each being a byte and each byte has been given an address.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .