| So the circuitry on the disc drive itself can write a | | | | itself part of the "Chip Set" which does almost |
| series of bits onto the surface of a magnetic disc and | | | | everything in your PC apart from the computation |
| get it back again. That doesn't explain how that series | | | | done by the processor chip. Sometimes the chip sets |
| of bits relates to your Word document, for example. In | | | | contain almost as many transistors as the processor |
| fact, quite a bit of work goes on, on the drive, in the | | | | itself - and when the Chip Set also provides graphics |
| chip on your PC's motherboard (the big printed circuit | | | | for the board may contain far more! |
| board that the processor etc are mounted on) and the | | | | So the DMA controller passes the commands on to |
| software running on your PC. Perhaps the easiest | | | | the disc drive, with the exception of the bits saying |
| way to understand the process is to follow it from | | | | where in system RAM to take the data from - that's |
| when Windows has decided where on the disc it is | | | | its own responsibility. The disc drive accepts the chain |
| going to write your document (a third article will build on | | | | of commands from the DMA controller. They are sent |
| this and the preceding one to explain that last piece of | | | | to the drive across that thick ribbon cable you can see |
| the jigsaw puzzle - how the operating system | | | | which connects the drive to the motherboard. These |
| organises your data on the disc etc. | | | | days, it may pass across a SATA cable which is |
| So You've clicked the "Save" button and selected | | | | much thinner as it has far fewer wires carrying signals |
| where you want the file to be saved and what it's to | | | | but this is made up for because the signals are sent a |
| be called. Windows has saved that information along | | | | a much higher frequency (much more often). Typically, |
| with where physically on the disc it's going to put your | | | | an older ribbon cable will have 80 cores, half of which |
| file. How it does that is very similar to what I'm about | | | | are "earth". Pairing each signal cable with an adjacent |
| to describe so I'm leaving it out for now. Windows has | | | | earth allows signals to be sent across the cable at a |
| decided on a Cluster Number where it will store the file. | | | | much higher frequency that they otherwise would so |
| A cluster is a physical group of Blocks on the disc. | | | | data gets transferred more quickly. |
| Windows allocates space in the disc in clusters | | | | The disc drive receives the command to Seek. It |
| because a block is usually quite small and it would be | | | | translates the LBA CCHHRR address it has been |
| inefficient to allocate individual blocks. Windows has | | | | given to a physical address. It looks where the head |
| been told by the computer's hardware how many | | | | assembly currently is and if it's not on the right cylinder, |
| cylinders are on the hard drive, how many tracks are | | | | it initiates moving it. It then waits until the head actuator |
| in each cylinder and how many blocks are on each | | | | circuitry tells it that it's in the right place. It also tells the |
| track (or so it thinks! - see below). | | | | head circuitry which of the heads needs to be used to |
| The location of a bit of data on the hard drive (i.e. the | | | | read or write data. Once the head has arrived on the |
| location of a Block) is given by three numbers: Which | | | | right track, the drive waits for the "index mark" to |
| cylinder it's in, which track in that cylinder it's on and the | | | | come round. This is a bit like a paint mark on the edge |
| block number within the track - how many blocks you | | | | of the disc which tells the drive where the blocks on |
| have to count going past after the disc's index mark | | | | the track start from. In actuality it's a small protrusion |
| has gone past. This address is often referred to as | | | | on the disc spindle which is sensed by a magnetic coil |
| the "CCHHRR" address: CC for Cylinder number, HH | | | | as the disc spins. So at the beginning of the track, the |
| for the Head (or track) number and RR for the | | | | disc starts reading. I'm going to ignore certain |
| Record (or Block) number. | | | | housekeeping data which the drive uses as it would |
| If you've ever looked at the disc setting in a computer | | | | make this explanation even more involved than it |
| BIOS or even just seen them flash past as the | | | | already is! The drive reads the Count field on the first |
| computer boots, you may have seen the legend | | | | block. This, amongst other things, contains the physical |
| "LBA". LBA stands for "Large Block Architecture" and | | | | disc address of the block. The drive checks this |
| is used when the real layout of the hard drive is such | | | | against what is in the command to make sure it has |
| that Windows cannot actually handle the numbers | | | | got to the right place. If it hasn't, modern drives will |
| involved because they exceed some limits coded into | | | | autonomously retry the seek a number of times. If the |
| Windows when discs were much smaller. For | | | | failure continues to be repeated, the operation is |
| example, many hard drives have only 2 or 3 tracks | | | | abandoned and the error reported to the DMA |
| per cylinder but many thousands of cylinders. If the | | | | controller. The latter informs the software which issued |
| number of cylinders is too big for Windows to handle, | | | | the commands (in our case, Windows). |
| the drive itself translates the CCHHR address of a | | | | Assuming the drive has moved the head to the right |
| block from LBA to Real - i.e. where the data really is | | | | cylinder and is reading from the right track, it carries on |
| on the drive. Suffice it to say that the drive does some | | | | reading data until it reads the Count field of the block it |
| some very simple maths to convert the LBA address | | | | has been asked to write. At this point it says to the |
| supplied to it by Windows to a real address it can use | | | | DMA controller "Where's my data?" and the controller |
| to position the head on the disc, etc. | | | | reads the data from the address in the command and |
| So what Windows actually does it to write some | | | | sends it across the cable to the drive. The latter waits |
| information into an area in RAM it has reserved for the | | | | until it sees the Key field go past and then the |
| purpose. This information consists of several | | | | beginning of the Data block and then starts to write |
| commands. A typical sequence of commands might | | | | the data it got from the DMA controller onto the disc |
| look something like this: | | | | platter. Every time it writes some of the data it asks |
| * Seek the read/write head to Cylinder 350, Track 24, | | | | the DMA controller for some more. Once all the data |
| Record 21 | | | | has been written the drive writes some information |
| * If the seek fails, tell me about it and stop | | | | used to check the integrity of the data and tells the |
| * The seek succeeded so write the data at RAM | | | | DMA controller that is has finished successfully. The |
| location 123456 to the disc at the location you did the | | | | DMA controller interrupts the processor to tell it that |
| seek to, for 1024 bytes | | | | the disc transfer has finished OK and that information |
| * Tell me when you've finished | | | | gets passed to the operating system. |
| Now that looks pretty straightforward... but who are | | | | Continuing with our hypothetical saving of your Word |
| these commands given to? | | | | document to disc, then Windows tells Word that the |
| The short answer is the DMA controller on the PC | | | | "write" was successful and you carry on with your |
| motherboard. Originally, this was a separate chip but | | | | writing. |
| these days it is part of a much larger chip which is | | | | |