Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.

Similar presentations


Presentation on theme: "Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID."— Presentation transcript:

1 Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID

2 Outline  Disks o Disk scheduling algorithms o Redundancy in storage systems, RAID  File Systems o Overview of file system o File system design o Consistency and crash recovery o Sharing files o Unix file system 2

3 Disk Geometry  Disks have multiple platters o Each platter has an head o The different heads are attached to a single arm o 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 3 Track Sector Cylinder Platters

4 Disk Access Delays  Time to access a disk sector is determined by 3 delays o Seek time  Time to move head to correct track o Rotational delay  Time for disk to rotate to correct sector o Transfer time  Time to read/write the bits of sector 4

5 Disk Performance Trends  Capacity o 100% per year (2X every year)  Transfer rate (BW) o 40% per year (2X every two years) o Typically, MB/s o Sector transfer time is microseconds  Seek time and Rotation time o 8% per year (1/2 every 10 years) o Seek and rotation time are typically 4-8 ms today o Disk scheduling aims to minimize these times, especially seek time 5

6 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 => Access to blocks on different cylinders o => The further the cylinders the worse it is

7 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 Disk exports its data as a logical array of blocks o Disk maps logical blocks to its surface o OS code is simpler but disk parameters are hidden 7

8 Layers of Abstraction  Program  File system  Device driver  Disk Controller 8

9 Disk Errors  Lots of errors possible o E.g., latent sector errors, mis-directed writes, etc. o Transient vs. hard errors o Some errors can be masked by ECC  Bad sectors o Allocate spare sectors per track o Block can be mapped to spare in various ways  In the factory, by the device controller, by OS o OS can hide bad sectors by allocating them to a special hidden file o Physical backup programs have to careful 9

10 Disk Scheduling Algorithms  Aim is to improve disk performance  Two methods o Reduce seeks and rotation o Read several blocks of data  Algorithms o First-come, first served (FCFS)  Simple, fair, slow o Shortest seek time first (SSF) o SCAN (Elevator) 10

11 Shortest Seek First (SSF)  Shortest seek first minimizes arm motion  Unlike FCFS, starvation is possible 11 Initial position Pending requests

12 SCAN (Elevator) 12

13 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 SCAN, but request go in one direction (typewriter) o What are its benefits/drawbacks vs. SCAN? 13

14 Modern Disk Scheduling  Disks know their layout better than the OS  May ignore or undo disk scheduling in OS! 14

15 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 Stripes on different disks can be read/written in parallel o Bandwidth increases with more disks o Better throughput for large requests  Choosing stripe size is important o Normally between 1KB to 1MB o Increase stripe size, as average file size increases 15

16 RAID Levels 0, 1  RAID level 0: disk striping o Distributes data across several disks for speed o No redundancy  RAID level 1: mirroring o Backup solution o Write both, read either o 50% utilization 16

17 RAID Levels 0, 1 17

18 RAID Levels 4, 5  RAID level 4: block striping, dedicated parity disk o Calculate XOR value of stripes across disks o Store XOR stripe value on separate disk o Uses one extra disk for parity  Utilization: (N-1)/N, N is the number of disks  RAID level 5: striping with distributed parity o Similar to 4 but parity information is distributed across all disks o Avoids bottleneck for parity disk o If a single disk dies, it has to be replaced  Information for that disk is recreated from the other disks  RAID level 6: o Can recovery from the loss of two disks o Allows (single) failure during disk recovery 18

19 RAID Levels 4, 5 19


Download ppt "Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID."

Similar presentations


Ads by Google