Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gigabyte v/s Gibibyte & Gigabit v/s Gibibit

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.

like image 445
hagrawal Avatar asked Nov 01 '22 01:11

hagrawal


1 Answers

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.

like image 191
assylias Avatar answered Nov 13 '22 23:11

assylias