240 likes | 356 Vues
This lecture covers essential concepts in disk access, including the types of disks such as magnetic and optical, along with RAID configurations. It explains how RAID allows for the integration of multiple drives to enhance data reliability through various levels, such as RAID-0, RAID-1, and RAID-5. The session also delves into read/write scheduling techniques, error handling mechanisms, and ensuring stable reads and writes. Understanding these topics is crucial for optimizing disk performance and data integrity in operating systems.
E N D
ITFN 2601Introduction to Operating Systems Lecture 21 Disk Access
Agenda • Disc Types • Magnetic • RAID • Optical • Read/Write Scheduling • Error Handling • Stable Read/Writes
Magnetic Disks • Cylinders • Ring Number • Heads • Which Platter to Read • Sectors • Rotational Location
RAID • Redundant Array of Inexpensive Disks • Allows for the amalgamation of many drives • Eliminates danger of a “Single Large Expensive Disk” • Built-in error mechanism • Built-in recovery mechanism • No Error/Recovery in RAID-0 and RAID-2
RAID Levels • 6 Levels • RAID-0: Write-Striping • RAID-1: Write-Mirror • RAID-2: Byte-Striping • RAID-3: Byte-Striping w/Parity • RAID-4: Write-Striping w/Parity • RAID-5: Write-Striping w/Parity-scattering
RAID 0 • Each write is issued to a different drive • Less wait for write-completion • Prefers drives being equivalent
RAID 1 • Writes are issued as in RAID 0 • Writes are identically issued to backup-discs • Highly size dependent
RAID 2 • As RAID 0, except write is broken into bytes • Normal writes are in block-sized chunks • Each byte is issued to a different drive
RAID 3 • Writes are broken and issued as RAID 2 • One disc is “Parity” • XOR of the bytes being written on that pass • One bit per byte
RAID 4 • As RAID 0 • Each parity bit represents one strip • Parity will have n bits, where n is the number of drives (minus the parity drive)
RAID 5 • Based on RAID 4 • If the Parity drive fails, all recovery data is lost! • Staggers Parity across drives • If any drive is lost, it’s data is recovered from Parity
Optical Devices • Optical Disks (LaserDisc) • 30cm diameter • Compact Disc • Audio [IS-10149; Red Book] (1980) • Computer [CD-ROM; Yellow Book] (1984)
Physical Construction • Data is encoded in Pits/Lands • Pit – On • Land – Off
Red/Yellow Specifications • Symbols • 8bits->14bits, Encoding & Error Correction • Frames • 42 Symbols (24 data bytes; 18 ECC) • Sectors • 98 Frames • 2048 data bytes • 288 ECC
CD-R/RW • Standard computer CD is “CD-ROM” • Disc is extruded plastic • CD-Recordable [Orange Book] (1989) • Disc has dye that is activated by light • CD-ReWritable • Dye has two states (transparent & opaque) • Drive has three lasers
DVD • Digital Video Disc (or Versatile) • Spiral is smaller • Pits/Lands are smaller • “Smaller” laser • Holds up to 4.7G (vs 650M) • 4 types • Single/Double Sided • Single/Double Layered
Low Level Formatting • Performed by the manufacturer • Dictates the structure of the drive • Writes each track with information about the track • Skips over “bad” sectors
Disk Format • Moving the head is slow • Disc would have to spin back • Cylinder Skew • Transfer rate may be slow • Interleaving sector #s
Disk Arm Scheduling • Rotation and Head movement are bad • First Come First Serve • Shortest Seek First • Identical to FIFO/SJF Process Scheduling • Elevator Algorithm • Keep moving in one direction • Turn around at end of requests
Error Handling • Bad sectors • Each drive has n sectors per track • Only m are available for use (m < n) • The rest are “backup” • If a sector has repeated read/write errors • Copy everything into the next backup sector • Mark the original as “bad”
Stable Storage • If an error occurs during a write … • Old data is gone • New data isn’t there • Stable storage ensures data integrity • Relies on the fact that errors are “uncommon” • Like RAID 1
Stable Writes • Stable Writes • Write the data on main-disc • Repeat until the write is successful • Write the data on secondary-disc • Stable Reads • Read from the main-disc • Repeat some number of times • Read from secondary-disc (if unsuccessful)
Crash Recovery • Valid data always exists • May not have last write, but is not invalid • Usually acceptable