Why is it so that 32 bit is limited to 4 GB RAM but it can easily support 1 TB HDDs?
How does the binary math work?
closed as not a real question by Indrek, Shinrai, Tom Wijsman, Journeyman Geek♦, KronoS Oct 13 '12 at 3:29
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.
The problem is with addressing: the RAM addressing is done on per-byte basis, so 2^32 allows to make 4G bytes addressable.
The hard-drive addressing is done on per-sector basis. Each sector is 512 bytes long. Thus a single 32 bit value allows to address a sector in 2 TB disk.
To allow access for disks greater than 2TB the Operating System uses 64 bit sector addresses.
It has nothing to do with binary mathematics. It's to do with the size of the address space you can create with a limited number of bits. Bits are exponential in terms of their individual addressing capabilities. Jumping from 32 bits to 64 bits does not grant you double the amount of address space than before, it grants you much much more. For example:
This is what 8 bits, or a byte looks like. Each bit is ordered and is of the value indicated. So with 8 bits, you can create a number in the range of 0 and 255. Try it yourself, add all the bits together and see what you get...
Simply put as...
However, add just one extra bit and you can step your value up to 511: (255 + 256) = 511
So imagine each address space is just a number, thus With 8 bits, you can address 256 bytes of memory. Perhaps the value 65536 or 64k looks familiar? That's because it is the number of bytes of memory that can be addressed with 16 bits. So with 32 bits, you can address 4 GB of memory:
Now to answer your question about hard drives. Hard drives don't have static physical wires that require an address space. Hard drives are dynamic, in that they have moving parts. At any given time, the OS doesn't have to address each byte on a hard drive. It can address some of it in memory while it is required (hence reading from disk to memory), then written back when it's not required. The hard drive controller has a driver that allows the OS to interface with the file system. File systems have an index, that is addressable and uses that to either load extended indexes or know where to seek to on the disk in order to obtain the data. This is why hard drives are slow compared to memory, because data access is a very mechanical process.
Think of your hard drive as a book. You could start reading each page to find what you are looking for, but that could take weeks. Instead, you will look at the index at the back of the book to get the page numbers that contain relevant information. You will then seek to those pages and read the information into your short term memory, where you will process the facts. At some point you will need to memorise something else, at which point you forget about the minor details for what you just read. Next time you want to access that information again, you flick to the index, look up the page number again and seek to the page in the book, where you read it into short term memory again.
Hope this helps.