Salta al contenuto
Note per Studenti External Memory - Disks, RAID and Optical Storage Report

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. 22 surfaces, 10001000 tracks per surface, 100100 sectors per track and 512512 bytes per sector give 2⋅1000⋅100⋅512=102 400 0002\cdot1000\cdot100\cdot512=102\,400\,000 bytes.

Access time

Formula (disk access time)

Taccess=Tseek+Tlatency+TtransferT_{access} = T_{seek} + T_{latency} + T_{transfer}

  • 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: Tlatency=12⋅60revolutions per minute⋅1000 msT_{latency} = \frac{1}{2} \cdot \frac{60}{\text{revolutions per minute}} \cdot 1000 \ \text{ms}
  • Transfer of DD bytes on a track of NN bytes (fraction of a revolution): Ttransfer=DN⋅TrevT_{transfer} = \frac{D}{N} \cdot T_{rev}

Example. At 72007200 rpm the average rotational latency is 12⋅607200⋅1000=4,17\tfrac12\cdot\tfrac{60}{7200}\cdot1000=4{,}17 ms.

Worked example: 7200 rpm gives Trev=60/7200T_{rev} = 60/7200 s =8,33= 8{,}33 ms, latency 4,174{,}17 ms. With 256 KB tracks, transferring 64 KB takes 64256⋅8,33=2,08\frac{64}{256} \cdot 8{,}33 = 2{,}08 ms. With seek 8,5 ms: T=8,5+4,17+2,08=14,75T = 8{,}5 + 4{,}17 + 2{,}08 = 14{,}75 ms. If the same data are spread over a cylinder of 8 surfaces read in parallel, the transfer is divided by 8: T=12,93T = 12{,}93 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 5050 and requests 90,52,10,5590,52,10,55 (in arrival order) FCFS travels 40+38+42+45=16540+38+42+45=165 cylinders, SSTF (52,55,90,1052,55,90,10) travels 2+3+35+80=1202+3+35+80=120.

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 nn of data Failures tolerated
0 striping: strips distributed in rotation over the disks, no redundancy nn 0 (one failure loses everything)
1 mirroring: each disk has a copy 2n2n 1 per pair
2 bit striping, Hamming code on dedicated disks, synchronised disks nn + check disks 1
3 byte striping, one parity disk n+1n + 1 1
4 block striping, dedicated parity disk (write bottleneck) n+1n + 1 1
5 like 4 but with parity distributed over all disks n+1n + 1 1
6 two independent redundancy computations distributed n+2n + 2 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 10101010, 01100110, 11111111 the parity is 00110011; if the second disk fails, 0110=1010⊕1111⊕00110110=1010\oplus1111\oplus0011.

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 10910^9 instead of 2302^{30} 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

Taccess=Tseek+Tlatency+TtransferT_{access} = T_{seek} + T_{latency} + T_{transfer}; Tlatency=12⋅60rpmT_{latency} = \tfrac12 \cdot \tfrac{60}{\text{rpm}} s (half a revolution); Ttransfer=DNTrevT_{transfer} = \tfrac{D}{N} T_{rev}. 7200 rpm: Trev=8,33T_{rev} = 8{,}33 ms, latency 4,174{,}17 ms; 64 KB on 256 KB track: 2,082{,}08 ms; seek 8,5 ms gives 14,7514{,}75 ms; 8 surfaces in parallel gives 12,9312{,}93 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 (2n2n 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 (n+2n+2, 2 failures). Reconstruction: a block is the XOR of the other disks (0110=1010⊕1111⊕00110110 = 1010 \oplus 1111 \oplus 0011).

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 2302^{30} in exercises.

Teoria collegata