CMSC 421 Operating Systems Lecture Notes (c) 1995 Howard E. Motteler DISKS ====== What's in a disk? ------------------ platter - the metal (or plastic) disks surface - oxide on one or both sides of the disk head - magnetic coil that moves over the surface track - path on surface under an (unmoving) head sectors - sections into which a track is divided cylinder - a stack of tracks [ Figures: - generic hard disk - floppy disk - fixed head disk & drum ] Disk hardware organization --------------------------- Physical drive; base, platter, motor, heads Motor control and analog electronics Disk controller: - translates bit stream to bytes; in most cases does error checking and correction - translates surface, track, and sector values into head and motor commands - may define track 0 and sector 0 with low-level format - some disks can be formatted with varying sector sizes and/or track width - some newer disks have more sectors on outer tracks Over time, the tendency is for controllers to become more "intelligent", e.g., to include bad block management Disk Addressing --------------- A _disk block_ is usually just a sector. (Sometimes disk blocks are groups of sectors; we will use the terms synonymously, here) A sector (or block) is the smallest addressable unit on a disk A disk block address has three components a = sector number b = surface c = cylinder (or track, since heads move together) Suppose there are s sectors per track t tracks per cylinder Then the sector (or block) address is c * s * t + b * s + a [ picture of numbered sectors ] For example, suppose we have a disk with s = 17 sectors per track and t = 10 tracks The block with disk address 542 can be found at c = cylinder = 542 / s * t = 3 b = surface = (542 mod s * t) / s = 32 / 17 = 1 a = sector = (542 mod s) = 15 Checking, we have 3 * 17 * 10 + 1 * 17 + 15 = 542 Access Time ------------ Three components: seek time - time to move heads to desired cylinder latency - time for desired sector to come under head transfer time - time to read the desired sector(s) Interleaving ------------- In some cases (with slow processors and fast disks), sectors can come off the disk faster than the processor can read them. If we just miss reading a sector, we must wait an entire rotation to read it In this case, it may be desirable to space out or _interleave_ the sectors Successively numbered sectors skip k sector positions in a a k:1 interleave (or just a k-interleave) Disks that may be interleaved often have a prime number of sectors around a track [ interleave examples ]