I was watching this video 32-Bit vs 64-Bit - The Advantage and at 1:19 (timestamp) the narrator mentioned the 4GB memory allocation for the 32-bit system. I later found out it should've been 4GiB but am still confused about the bit vs byte part. After all, it's a 32-"bit" and not 32-"byte" system.
1 Answer
"32-bit" describes the size of many of the units of data that the processor can use. In this context, it refers to the size of memory addresses. A 32-bit address can address $2^{32}$ distinct objects; in a byte addressable system, that means it can address $2^{32}$ distinct bytes.
We don't give addresses to individual bits in memory, but rather groups of bits. In a byte addressable system those are bytes (ie, octets of 8 bits); you can also have a word-addressable system where you can only address groups of, say, 32 bits. In a system with 32-bit addresses addressing 32-bit words, you'd be able to use $32 * 2^{32}$ bits, or 17GB! But nowadays most consumer hardware in phones/computers are byte addressable.
Concretely, in byte-addressable memory, the first 8 bits are referred to as byte 0, the next 8 bits are referred to as byte 1, and the last 8 bits are referred to as byte 4294967295. There is no pointer to individual bit 26; you instead need to read/write the entire byte that contains it (byte with address 3 contains the 27th bit)
-
$\begingroup$ Isn't 32 * 2^32 = 2^37 ~ 128GB? Also, is there 24-bit allocation in byte-addressable memory (last para)? Thanks for the answer! $\endgroup$– AnjishnuJun 27, 2019 at 5:45
-
$\begingroup$ You made the wrong assumption that a pointer addressed 1 bit. That was explained, but now you assume it addresses 32 bytes. That’s nonsense. It addresses ONE byte (on a typical modern system). $\endgroup$ Jun 27, 2019 at 11:53
-
$\begingroup$ That was quite silly of me. But the line "In a system with 32-bit addresses addressing 32-bit words, you'd be able to use 32∗(2^32) bits, or 17GB" is yet unclear. Would appreciate any clarification. $\endgroup$– AnjishnuJun 27, 2019 at 20:00
-
$\begingroup$ @Anjishnu, what is unclear? In such a system, you can address 2^32 different words, and each word has 32 bits, for a grand total of 32*2^32 bits. $\endgroup$– Curtis FJun 27, 2019 at 23:45