5

Please note: I know the differences, so this question is not to know the difference between them but for something else.

I am putting below my understand and knowledge (for those who are not aware), compiled from reliable sources of information.

  1. All of these are unit of multiple of byte for digital information.
  2. Gigabyte and Gigabit are for decimal notation and represent byte and bit respectively in power of 10.

    • Gigabyte = 10^9 bytes (GB)
    • Gigabit = 10^9 bits (Gb or Gbit)
  3. Gibibyte and Gibibit are for binary notation and represent byte and bit respectively in power of 2.

    • Gibibyte = 2^30 bytes (GiB)
    • Gibibit = 2^30 bytes (Gibit)
  4. For sake of symbol, byte will always be represented as B and bit will always be represented as b.

As per best of my knowledge, above information is true.

Below is quote which can be seen at many places including Wiki 32-bit, Stackoverflow 32 bit etc. And as per below, 32 bit memory address can access 4 GiB (which means 4 gibibyte and not 4 gibibit) of byte addressable memory.

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

Question:
I am really really confused (in fact going nuts) that how 2^32 bit memory address can access 4 gibibyte of addressable memory? Shouldn't it be 4 gibibit or .5 Gibibyte?
1 byte has 8 bits, so if we are talking about memory in terms of bytes then isn't 2^32 bits would mean .5 gibibyte or 4 Gibibit?

I mean how 2^32 bit can be represented as 4 GiB or 4 gibibyte? It cannot be some convention because bytes and bits cannot be played like this. So, there HAS be a proper reason.
If there are 2^32 memory address and each storing 1 byte then it means I have 2^32 * 2^3 = 2^35 bits of memory. Then its no more 2^32 but 2^35. No?

P.S.: I am not a CS graduate so please forgive me.

Community
  • 1
  • 1
hagrawal7777
  • 14,103
  • 5
  • 40
  • 70
  • 3
    It looks like this one was answered here: http://superuser.com/questions/699737/can-a-32-bit-cpu-address-4-gigabits-or-4-gigabytes-of-memory-address-space – Keith Jun 26 '15 at 19:11
  • 1
    Note the definition: "byte addressable memory". – RealSkeptic Jun 26 '15 at 19:13
  • @RealSkeptic Even if "byte addressable memory", then also how 4 GiB? With 2^32 bits how 4 GiB can be deduced, and that's the part I am not able to understand .. When you talk in byte, then 1 byte = 8 bits, so conversion is needed. "byte addressable memory" is fine but why 4 GiB? – hagrawal7777 Jun 26 '15 at 19:26
  • @Keith Thank for the link. But, for me, the answer which was accepted was talking something totally different like memory shortage, swaps etc. instead of explaining real thing. – hagrawal7777 Jun 26 '15 at 19:32
  • [4 GiB](http://www.lonniebest.com/DataUnitConverter/#4GiB) – Lonnie Best Oct 25 '21 at 03:48

1 Answers1

2

2^32 = 4294967296 - so on a 32 bit architecture you can reach 4 billion addresses in memory. And one byte (8 bit) is stored at each address.

So your "maximum memory" is indeed 2^32 bytes or 4 x 2^30 bytes or 4 GiB.

assylias
  • 321,522
  • 82
  • 660
  • 783
  • Okk .. So if I talk about memory then at the lowest level I have bits to store information. Now when you say 2^32 bit of addresses in memory and each storing 8 bytes, then doesn't it become 2^35 bit of addresses in memory or 2^35 bit of memory? Then it means saying 2^32 bit memory architecture is wrong... – hagrawal7777 Jun 26 '15 at 19:42
  • 1
    @hagrawal It's not "2³² bit architecture". The term is "32 bit architecture" meaning the size of a CPU register that can contain a memory address. – RealSkeptic Jun 26 '15 at 19:51
  • @RealSkeptic Yes sir, I got that part .. 32 bit system will have 4 byte or 32 bit of memory address, and 64 bit system will have 8 byte of 64 bit of memory address ..But other parts is what I am getting skeptical about .. – hagrawal7777 Jun 26 '15 at 19:55
  • Probably should have not commented "saying 2^32 bit memory architecture is wrong" .. – hagrawal7777 Jun 26 '15 at 19:56
  • 2
    32 bit is the size of a memory address - but the content located at that memory address is always one byte (on usual architectures). So on a 16 bit CPU, you can reach 2^16 *bytes* of memory - on a 32 bit CPU you can reach 2^32 *bytes* of memory. Etc. I'm not sure I understand what part is unclear to you... – assylias Jun 26 '15 at 20:03
  • @assylias Ahh .. I seeee .. Like I said, I am not a CS graduate but trying to fill up the gaps .. I thought that if it is 16 bit architecture then CPU registers can store 2^16 different values (which I understood correct) and each of this register will hold an memory address which will be 16 bit long (which also I understood correct) and that memory address will also hold a 16 bit values (which is where I was messing up) .. – hagrawal7777 Jun 26 '15 at 22:48
  • @assylias Please correct me if I am wrong - so, if there is a OS with 3 bit architecture or 3 bit OS (hypothetical) then it can have a maximum RAM size of 8 bytes, it will have 8 CPU registers each holding 3 bit of memory address and at those memory address there would be 1 byte of data stored .. – hagrawal7777 Jun 26 '15 at 22:50
  • @assylias If you don't mind then would you suggest me some good reading or not-too-lengthy books to make strong foundation for CS .. I have completed Stanford's CS101 but these things were not covered .. I am taking other intro to CS courses as well, but I guess these type of things are not covered in those courses .. – hagrawal7777 Jun 26 '15 at 22:53
  • @RealSkeptic Thank you for your inputs. If you don't mind then would you suggest me some good reading or not-too-lengthy books to make strong foundation for CS .. – hagrawal7777 Jun 26 '15 at 22:53
  • @hagrawal yes that's correct. I don't know any recent CS books - my knowledge on this dates back to the 80s I'm afraid! – assylias Jun 26 '15 at 23:52
  • @assylias Not a problem, thank you. Asked just in case if you could help me with some good stuff from the top of your head, wanted to get benefited by from your experience. :) – hagrawal7777 Jun 27 '15 at 13:02