How does your CPU control a HDD, does the HDD have its own tiny processor to tell the arm where to move?

248 views

[ad_1]

How does your CPU control a HDD, does the HDD have its own tiny processor to tell the arm where to move?

In: Technology
[ad_2]

Ever heard of the BIOS? It’s the Basic Input Output System that runs on your motherboard. It’s the thing that loads and runs before Windows starts up, and runs even if you don’t have a hard drive in your computer. Your CPU talks to all of your computer’s devices- HDD, serial ports, your monitor- through the BIOS.

Your motherboard had a bunch of built-in chips designed to control those devices, which your CPU calls on when it needs to talk to them.

The devices, in turn, generally have chips of their own. You HDD does have a built-in controller. So it goes CPU->Motherboard->HDD controller.

Yes.

It used to be different, a very long time ago, but nowadays the HDDs are basically small computers in themselves.

The change really came in the PC market with the introduction of IDE (“Integrated Drive Electronics”, literally telling you that this is true!) and SCSI drives. The intelligence needed on the drive was there to strip out all the factors that confused things – you used to be able to low-level format hard drives, like you could with floppy disks, which would literally change the on-disk storage format to squeeze more data onto them. Those days went away quickly as they basically caused nothing but problems, but originally the drives were so expensive and the chips to control them just as much so, that people economised and the PC did the work. PCs used to “slow down” when using the floppy drive as they had to wait for it to respond to commands and they couldn’t take the chance of missing a response, so they’d dedicate all their processing to controlling the drive rather than what you might have wanted them to do.

As soon as electronics became cheap enough that you could make the drive do the work itself and the PC could just carry on doing its stuff, that’s what happened for all kinds of technology – sound cards, video cards, disk drives, network interfaces, even things like controlling mouse/keyboard/USB ports are handled by their own chips and the main computer is just given the result and gives out orders, and the on-board chips actually do the hard work.

The modern HDD does all kinds of things from managing damaged parts of the disk to avoid them, storing data elsewhere, encrypting the data on the drive, keeping copies in case the drive goes wrong, putting common data on the fastest part of the disk (the outside spins faster than the inside), knowing how many platters, etc.

The modern PC knows almost nothing about how the drive itself is operating, how many heads, platters it’s got, what speed it is spinning at, etc. It only knows what the drive chooses to tell it.

Not so long ago, you had to program settings into your BIOS for the disk to work (how many cylinders, heads, sectors, etc.) and long before that the computer basically did all the hard work itself. It sometimes got so bad that one person would create data on a disk and then when you put that disk somewhere else you had to recreate that configuration or you wouldn’t be able to read the disk at all (this applied mainly to floppy disks, but there’s really very little difference between a hard disk and a floppy disc in terms of how they operate). It was even used as copy-protection in some cases, because it was possible to make a disk on a very configurable machine and people could read that disk in their machine, but their home machine itself couldn’t write to it in the same way. So people couldn’t make copies, only people with the very expensive equipment.

Nowadays, pretty much everything has a tiny chip doing all the hard work, and it just nudges (“interrupts”) the main computer when it’s done the job that was asked of it.

Yes. Your CPU sends generalized instructions via the bus to the HDD. The HDD has it’s own circuit board which has a Main Controller Unit (MCU), Memory (cache), a motor controller and a ROM containing the drives’ firmware. This mini computer serves to controls how data is both read and written to exact locations on the disc.

As far as your motherboard/CPU is concerned it is sending an instruction to read from or access a particular memory address on the hard drive – think of it like giving someone your address – that doesn’t mean that the person knows exactly where you live – they still need to look it up on their GPS app to find you. The hard drive circuit board does the actual hard work of interpreting an address to an exact physical location.

Not that tiny, actually!

Some mad lad [got Linux to boot on a hard disk](http://spritesmods.com/?art=hddhack). Turns out it’s got 4 cores at 150 MHz and 64MB RAM. Very lightweight by modern standards, but I’ve done plenty gaming on much worse hardware than that.

But in general most devices of any complexity are going to have some sort of CPU. Some of the early laser printers even needed a CPU more powerful than the computer they were attached to.

These days (well for some time really) yep.

Imagine it like this. You work in an office and you need a particular file that’s stored in the archive room. So you tell your co-worker I need this file in the 3rd drawer down of the 4th file cabinet from the left, and they come back with the paper. In the same way, the CPU tells the HDD what location it needs data from and the HDD takes care of actually retrieving it.

Yes.

The HDD has a little “controller” that knows how to move its arms, and knows where different data addresses are physically located on the disk platters. Your computer communicates with the controller and the controller handles actually fetching or storing the data.

That’s why it’s possible to replace an old iPod or computer’s HDD with an SSD and the iPod/computer won’t even know the difference. The iPod or computer is talking to a little controller and just telling it what data addresses to read/write, same as ever. It’s completely oblivious to whether that data is being stored on a magnetic platter or in floating-gate transistors.