Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When 32 bit machine can access max of 4GB RAM, how does it access 150GB of HDD [closed]

I understand that the memory size that can be accessed by a 32 bit machine is limited to 4GB. Since there are I/O ports like PCIe, USB, Serial, Parallel, PS/2, Audio I/O, CD drive, floppy drive, memory card readers e.t.c that have to be dealt with as well, the result is that less than 4GB RAM is supported by the CPU itself. All the things I have just mentioned and others take quite a bit of memory also.

Now what I am confused about is how can it support several GB of hard disk space? How is it able to access even upto a 1 TB of external storage through these SATA/ATA interfaces. The same goes with the USB mass storage devices like external USB hard disks as well, I am suprised that such a big storage can be accessed by the CPU while being limited to 32 bits. Is there no limit to how big HDD can be supported by a 32 bits processor?

like image 746
quantum231 Avatar asked Mar 24 '23 02:03

quantum231


2 Answers

Not sure where to begin :-)

This is a very-very simplistic explanation, not exactly true ever since the 286, but might help you grasp basic concepts:

Memory addressing is done via an address bus: a 32 bit address bus can express 2^32 different addresses. The smallest amount of memory manipulable in one operation is called the "word" size, which is limited by the width of the data bus.

The maximum amount of addressable memory is word size times the number of addresses.

In "block IO" operations, the equivalent of the word size is the block size, usually much bigger. This is a trade-off: larger data can be accessed with the same address length, but flipping a single bit requires overwriting the whole block.

The bigger difference is that the address does not need to be present at the same time on an "address bus" like in memory: commands (and responses) are transmitted in sequential "packets", like on a network. There is thus no hardware-imposed limit on address size, albeit I am sure the protocol specifies a reasonable upper bound.

As you can see, addressable disk size is completely unrelated to CPU bus widths and register sizes.

like image 155
Szocske Avatar answered Apr 24 '23 23:04

Szocske


For most nowadays application developers prefer to deal with 64 bit file pointers. For example lseek64 for linux or SetFilePointer for Windows - so from file point of view you can address 2^64 single file.

But from hardware level it is more interesting - because each disk is splitted (in logical units on clusters, in disk units on sectors). Each cluster is many bytes that can be addressed and read by single query. Operation systems hides from you these operations. But terabyte much more easily to address in terms of cluster.

like image 45
Dewfy Avatar answered Apr 24 '23 23:04

Dewfy