Transcript Disk Performance
Operating Systems ECE344 Disks and RAID
Ashvin Goel ECE University of Toronto
Outline
Disks
o o Disk scheduling algorithms Redundancy in storage systems, RAID File Systems o o o o o Overview of file system File system design Consistency and crash recovery Sharing files Unix file system 2
Disk Geometry
Disks have multiple platters o o o Each platter has an head The different heads are attached to a single arm The different heads can access data in parallel Each platter has multiple concentric tracks o A cylinder consists of the same track across different platters Each track has multiple sectors o A sector typically has preamble, data and ECC Track Platters Sector Cylinder 3
Disk Access Delays
Time to access a disk sector is determined by 3 delays o o o Seek time Time to move head to correct track Rotational delay Time for disk to rotate to correct sector Transfer time Time to read/write the bits of sector 4
Disk Performance Trends
Capacity o 100% per year (2X every year) Transfer rate (BW) o o o 40% per year (2X every two years) Typically, 50-100 MB/s Sector transfer time is 100-200 microseconds Seek time and Rotation time o o o 8% per year (1/2 every 10 years) Seek and rotation time are typically 4-8 ms today Disk scheduling aims to minimize these times, especially seek time 5
Disk Performance
Fastest: No head movement, no rotational latency o => Sequential access Faster: no head movement, rotational latency o => Access to blocks on the same cylinder is faster Slow: head movement, rotational latency o o => Access to blocks on different cylinders => The further the cylinders the worse it is
Addressing Disks
Older disks required OS to specify all parameters for transferring data o E.g., cylinder #, track #, sector #, transfer size Modern disks are more complicated o Not all sectors are the same size, sectors are remapped, etc.
Current disks provide a higher-level interface o o o Disk exports its data as a logical array of blocks Disk maps logical blocks to its surface OS code is simpler but disk parameters are hidden 7
Layers of Abstraction
Program
Disk Errors
Lots of errors possible o o o E.g., latent sector errors, mis-directed writes, etc.
Transient vs. hard errors Some errors can be masked by ECC Bad sectors o o o o Allocate spare sectors per track Block can be mapped to spare in various ways In the factory, by the device controller, by OS OS can hide bad sectors by allocating them to a special hidden file Physical backup programs have to careful 9
Disk Scheduling Algorithms
Aim is to improve disk performance Two methods o o Reduce seeks and rotation Read several blocks of data Algorithms o o o First-come, first served (FCFS) Simple, fair, slow Shortest seek time first (SSF) SCAN (Elevator) 10
Shortest Seek First (SSF)
Initial position Pending requests Shortest seek first minimizes arm motion Unlike FCFS, starvation is possible 11
SCAN (Elevator)
12
SCAN (Elevator)
Use a bit to track outward or inward arm direction Service the next pending request in same direction When there are no more requests in the current direction, reverse direction Increases seek compared to SSF but ensures no starvation A variant is called C-SCAN o o SCAN, but request go in one direction (typewriter) What are its benefits/drawbacks vs. SCAN?
13
Modern Disk Scheduling
Disks know their layout better than the OS May ignore or undo disk scheduling in OS!
14
Redundancy in Storage Systems
Idea: Use many disks in parallel o Increases storage bandwidth, improves reliability Redundant Array of Inexpensive Disks (RAID) o A storage system, not a file system Files are striped across disks o o o Stripes on different disks can be read/written in parallel Bandwidth increases with more disks Better throughput for large requests Choosing stripe size is important o o Normally between 1KB to 1MB Increase stripe size, as average file size increases 15
RAID Levels 0, 1
RAID level 0: disk striping o o Distributes data across several disks for speed No redundancy RAID level 1: mirroring o o o Backup solution Write both, read either 50% utilization 16
RAID Levels 0, 1
17
RAID Levels 4, 5
RAID level 4: block striping, dedicated parity disk o o o Calculate XOR value of stripes across disks Store XOR stripe value on separate disk Uses one extra disk for parity Utilization: (N-1)/N, N is the number of disks RAID level 5: striping with distributed parity o o o Similar to 4 but parity information is distributed across all disks Avoids bottleneck for parity disk If a single disk dies, it has to be replaced Information for that disk is recreated from the other disks RAID level 6: o o Can recovery from the loss of two disks Allows (single) failure during disk recovery 18
RAID Levels 4, 5
19