External Memory - Disks, RAID and Optical Storage
In questa pagina 7
In questa pagina 5
Magnetic disk
- Rotating platters coated with magnetic material; each platter has two surfaces, each with a read/write head mounted on an arm. The heads are all on the same arm and move together. In Winchester technology the head "flies" very close to the surface without touching it, in a sealed enclosure.
- Each surface is divided into concentric tracks, each track into sectors (smallest read/write unit, typically 512 bytes or 4 KB). Formatting adds to each sector a header, synchronisation and check codes.
- Cylinder: the set of tracks at the same position on all surfaces. Data on a cylinder can be read without moving the arm, with the heads in parallel.
Formula (disk capacity). Capacity = surfaces x tracks per surface x sectors per track x bytes per sector.
Example. surfaces, tracks per surface, sectors per track and bytes per sector give bytes.
Access time
Formula (disk access time)
- Positioning (seek): moving the head onto the track; a datum of the disk (average value).
- Rotational latency: waiting for the sector to pass under the head; on average half a revolution:
- Transfer of bytes on a track of bytes (fraction of a revolution):
Example. At rpm the average rotational latency is ms.
Worked example: 7200 rpm gives s ms, latency ms. With 256 KB tracks, transferring 64 KB takes ms. With seek 8,5 ms: ms. If the same data are spread over a cylinder of 8 surfaces read in parallel, the transfer is divided by 8: ms.
Positioning and latency dominate: reading contiguous data is far more efficient than reading scattered data.
Request scheduling
With several requests in the queue, the order in which they are served changes the total arm movement.
Definition (disk scheduling: FCFS, SSTF and elevator)
Algorithm Rule Characteristics FCFS (FIFO) arrival order fair, often the slowest SSTF (shortest seek time first) the request nearest to the current cylinder minimum movement, but far requests may wait long and there are many reversals elevator (SCAN) continues in the current direction serving the requests it meets, reverses when there are no more few arm reversals (less mechanical wear), good performance
Example. With the head on cylinder and requests (in arrival order) FCFS travels cylinders, SSTF () travels .
RAID
Redundant Array of Independent Disks: several disks seen by the operating system as one, for performance (parallel accesses) and reliability (redundancy).
| Level | Organisation | Disks for of data | Failures tolerated |
|---|---|---|---|
| 0 | striping: strips distributed in rotation over the disks, no redundancy | 0 (one failure loses everything) | |
| 1 | mirroring: each disk has a copy | 1 per pair | |
| 2 | bit striping, Hamming code on dedicated disks, synchronised disks | + check disks | 1 |
| 3 | byte striping, one parity disk | 1 | |
| 4 | block striping, dedicated parity disk (write bottleneck) | 1 | |
| 5 | like 4 but with parity distributed over all disks | 1 | |
| 6 | two independent redundancy computations distributed | 2 |
Property (parity and reconstruction in RAID). Parity allows reconstruction: if a disk fails, each of its blocks is the XOR of the corresponding blocks of the other disks.
Example. With blocks , , the parity is ; if the second disk fails, .
SSD
Flash memory (see Semiconductor MemoryMemory cell and operations; dynamic RAM (capacitor, refresh) and static RAM (flip-flop) compared; ROM, PROM, EPROM, EEPROM and flash; organisation of chips and modules with calculation of address lines and number of chips; synchronous DRAM and DDR; errors and correcting codes.Semiconductor Memory →): no mechanical parts, hence no positioning or rotational latency; access in tens of microseconds. The cells endure a limited number of erasures: the controller spreads the writes (wear leveling).
Optical memories and tapes
- CD-ROM: a single spiral track; data are engraved as pits and lands and read by a laser from the variation of reflected light; constant linear velocity (the disc spins slower toward the outside); about 650-700 MB. CD-R writable once, CD-RW rewritable.
- DVD: laser with shorter wavelength, denser tracks, more layers and two sides: from 4,7 to 17 GB. Blu-ray: up to 25 GB per layer.
- Magnetic tape: sequential access, very low cost per bit; used for archives and backup.
Typical mistakes
- Using the time of a full revolution as latency: the average latency is half a revolution.
- Forgetting to convert revolutions per minute into per second (divide by 60).
- Using instead of for GB in track calculations: in exercises capacities are powers of 2.
Versione ripasso
Disk
Platters, two surfaces each with a head (all on one arm), concentric tracks divided into sectors; cylinder = same track on all surfaces, read with no arm movement. Capacity = surfaces x tracks x sectors x bytes per sector.
Access time
; s (half a revolution); . 7200 rpm: ms, latency ms; 64 KB on 256 KB track: ms; seek 8,5 ms gives ms; 8 surfaces in parallel gives ms. Positioning and latency dominate.
Scheduling
FCFS (arrival order), SSTF (nearest request; starvation, many reversals), elevator/SCAN (keeps direction, few reversals). Head at 50, requests 90, 52, 10, 55: FCFS 165 cylinders, SSTF 120.
RAID
0 striping (no redundancy); 1 mirroring ( disks); 2 bit striping with Hamming code; 3 byte striping + parity disk; 4 block striping + dedicated parity (write bottleneck); 5 distributed parity; 6 double redundancy (, 2 failures). Reconstruction: a block is the XOR of the other disks ().
SSD, optical, tape
SSD: flash, no mechanics, tens of microseconds, wear leveling. CD about 650-700 MB (spiral track, pits and lands, constant linear velocity); DVD 4,7-17 GB; Blu-ray up to 25 GB per layer. Tape: sequential, cheap, backup.
Typical mistakes: latency is half a revolution; convert rpm to per second; GB as in exercises.