views:

134

answers:

5

I didnt understand this because 2^32 is 4 giga bits not bytes right ? since 2^2 * 1024* 1024* 1024 bits right ? Am I wrong ?

+7  A: 

The smallest individually addressable unit of memory is a byte. Bits don't have addresses. You have to read a byte or more and then do bit masking and such to get at the individual bits.

John Kugelman
+1  A: 

No, it is Gigabytes. A byte has 8 bits so you have to multiply the resulting number by 8 to get the bits. As john said in his answer you cant address individual bits, you will have to do bit shifting and masking to get to individual bits.

Faisal Feroz
so smallest value I can access is a byte ? I heard in 32 bit machines it 4 bytes and 64 bit machine its 8 bytes. Am i wrong ?
brett
@brett: it's eight bits (**bits**, not bytes) on all common machines of the last few decades.
Michael Petrotta
+5  A: 

As far as i can recall from my college days, this is how it goes

If 32 = size of the address bus, then the total number of memory addresses that can be addressed = 2^32 = 4294967296

However, these are 4294967296 Addresses of memory locations. Since each memory location itself = 1 Byte, hence this gives us 4294967296 bytes that can be addressed.

Hence 4GB Memory can be addressed.

InSane
A: 

the above answer solves it, and if you wish to address more then 4 gb then you can use an offset memory register, that can help you address a wider range.

none
I guess you are referring to PAE (Page Address Extension) ? It only allows the kernel to access more than 4GB (and map memory beyond 4GB into a tasks page list), but each task is still limited to 4GB virtual address space. On 32bit x86, a pointer is just 32 bits no matter what you do :-)
DarkDust
A: 

In the old console days SNES and Megadrive games were measured in MegaBits because by definition an 8MegaBit game sounds bigger than a 1 MegaByte game. In the end most people said 8Megs so again the confusion gave the impression of 8Megabytes for most people. Im not sure if brett is talking about SNES or Megadrive programming but remember 8 Megabits = 1 Megabyte.

mP
... and this answers the question how ? :-)
DarkDust
Dunno Brett did not say what platform he was talking about but for me when one says MegaBits it must mean console from the 80/90s
mP