Bytes in a 32 bit system?
I am in the process of interviewing at a few places and I saw this question开发者_如何学Go in one of the discussion forums.
How many bytes are contained in a 32 bit system?
The answer given is 2^29 or 536870912 - I believe it's because a 32 bit system can address 2^32 bits of memory and 8 bits to a byte gives 2^32/8 = 2^29 bytes. Can someone confirm if I'm on the right track?
Thanks!
Addressable unit is a byte, not a bit.
So 32bit pointer allows to address 2^32 bytes.
If the question really was: "How many bytes are in a 2^32 bit system?", the answer is correct.
(But still bad phrased)
It's not that 2**32 bits are accessible, it's that 2**32 words are accessible. If we say 4 bytes per word, then 2**34 bytes is a closer value.
Although traditional systems are byte-oriented and therefore could access 2**32 bytes.
精彩评论