24
ITFN 2601 Introduction to Operating Systems Lecture 21 Disk Access

ITFN 2601 Introduction to Operating Systems

  • Upload
    taini

  • View
    24

  • Download
    0

Embed Size (px)

DESCRIPTION

ITFN 2601 Introduction 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. Disk Hardware. - PowerPoint PPT Presentation

Citation preview

Page 1: ITFN 2601 Introduction to Operating Systems

ITFN 2601Introduction to Operating

Systems

Lecture 21

Disk Access

Page 2: ITFN 2601 Introduction to Operating Systems

Agenda

Disc TypesMagneticRAIDOptical

Read/Write SchedulingError HandlingStable Read/Writes

Page 3: ITFN 2601 Introduction to Operating Systems

Magnetic Disks

CylindersRing Number

HeadsWhich Platter to Read

SectorsRotational Location

Page 4: ITFN 2601 Introduction to Operating Systems

Disk Hardware

Page 5: ITFN 2601 Introduction to Operating Systems

RAID

Redundant Array of Inexpensive DisksAllows for the amalgamation of many drivesEliminates danger of a “Single Large

Expensive Disk”

Built-in error mechanismBuilt-in recovery mechanism

No Error/Recovery in RAID-0 and RAID-2

Page 6: ITFN 2601 Introduction to Operating Systems

RAID Levels

6 LevelsRAID-0: Write-StripingRAID-1: Write-MirrorRAID-2: Byte-StripingRAID-3: Byte-Striping w/ParityRAID-4: Write-Striping w/ParityRAID-5: Write-Striping w/Parity-scattering

Page 7: ITFN 2601 Introduction to Operating Systems

RAID 0

Each write is issued to a different driveLess wait for write-completionPrefers drives being equivalent

Page 8: ITFN 2601 Introduction to Operating Systems

RAID 1

Writes are issued as in RAID 0

Writes are identically issued to backup-discsHighly size dependent

Page 9: ITFN 2601 Introduction to Operating Systems

RAID 2

As RAID 0, except write is broken into bytesNormal writes are in block-sized chunks

Each byte is issued to a different drive

Page 10: ITFN 2601 Introduction to Operating Systems

RAID 3

Writes are broken and issued as RAID 2One disc is “Parity”

XOR of the bytes being written on that passOne bit per byte

Page 11: ITFN 2601 Introduction to Operating Systems

RAID 4

As RAID 0Each parity bit represents one strip

Parity will have n bits, where n is the number of drives (minus the parity drive)

Page 12: ITFN 2601 Introduction to Operating Systems

RAID 5

Based on RAID 4If the Parity drive fails, all recovery data is lost!

Staggers Parity across drivesIf any drive is lost, it’s data is recovered from Parity

Page 13: ITFN 2601 Introduction to Operating Systems

Optical Devices

Optical Disks (LaserDisc)30cm diameter

Compact DiscAudio [IS-10149; Red Book] (1980)Computer [CD-ROM; Yellow Book] (1984)

Page 14: ITFN 2601 Introduction to Operating Systems

Physical Construction

Data is encoded in Pits/Lands

Pit – OnLand – Off

Page 15: ITFN 2601 Introduction to Operating Systems

Red/Yellow Specifications

Symbols8bits->14bits, Encoding & Error Correction

Frames42 Symbols (24 data bytes; 18 ECC)

Sectors98 Frames

2048 data bytes288 ECC

Page 16: ITFN 2601 Introduction to Operating Systems

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-ReWritableDye has two states (transparent & opaque)Drive has three lasers

Page 17: ITFN 2601 Introduction to Operating Systems

DVD

Digital Video Disc (or Versatile)Spiral is smallerPits/Lands are smaller“Smaller” laser

Holds up to 4.7G (vs 650M)4 types

Single/Double SidedSingle/Double Layered

Page 18: ITFN 2601 Introduction to Operating Systems

Low Level Formatting

Performed by the manufacturer

Dictates the structure of the driveWrites each track with information about the

trackSkips over “bad” sectors

Page 19: ITFN 2601 Introduction to Operating Systems

Disk Format

Moving the head is slowDisc would have to

spin backCylinder Skew

Transfer rate may be slowInterleaving sector #s

Page 20: ITFN 2601 Introduction to Operating Systems

Disk Arm Scheduling

Rotation and Head movement are badFirst Come First ServeShortest Seek First

Identical to FIFO/SJF Process Scheduling

Elevator AlgorithmKeep moving in one directionTurn around at end of requests

Page 21: ITFN 2601 Introduction to Operating Systems

Error Handling

Bad sectorsEach drive has n sectors per trackOnly 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 sectorMark the original as “bad”

Page 22: ITFN 2601 Introduction to Operating Systems

Stable Storage

If an error occurs during a write …Old data is goneNew data isn’t there

Stable storage ensures data integrityRelies on the fact that errors are

“uncommon”Like RAID 1

Page 23: ITFN 2601 Introduction to Operating Systems

Stable Writes

Stable WritesWrite the data on main-disc

Repeat until the write is successful

Write the data on secondary-disc

Stable ReadsRead from the main-disc

Repeat some number of times

Read from secondary-disc (if unsuccessful)

Page 24: ITFN 2601 Introduction to Operating Systems

Crash Recovery

Valid data always existsMay not have last write, but is not invalid

Usually acceptable