Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.

Similar presentations


Presentation on theme: "CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID."— Presentation transcript:

1 CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID

2 Disks Anatomy (Figure 10.1) –Sector, track, cylinder, platter –Read/write head attached to arm, attached to arm assembly –Head quickly reads binary data as: orientation of iron ions or reflectiveness of surface Example: CD –About 25,000 tracks, 50 sectors per track  1 bit occupies about 1 square  m –Entire CD can be read in about 7 minutes on a 12x speed drive But usually we don’t read entire disks 2 aspects dominate access time: –Seek time: proportional to square root of seek distance –Rotational latency

3 Some specs Floppy diskHard drive (2001)Hard drive (2011) Cylinders4010 601310 101 Tracks/cylinder21216 Sectors/track9281 (average)63 Sectors/disk72035 742 000312 500 000 Bytes/sector512 Capacity360 KB18 GB160 GB Seek adjacent track6 ms0.8 ms Seek (average)77 ms6.9 ms9.5 ms Rotation200 ms8.3 ms Transfer 1 sector22 ms 17  s1.7  s

4 Disk scheduling Common problem is a backup of disk requests Disk queue When disk is ready, in what order should it do the disk requests? Similar to problem of scheduling CPU Pending jobs are classified by which track/cylinder they want to access Ex. 4, 7, 16, 2, 9, 1, 9, 5, 6 Several disk scheduling algorithms exist –Simple approach: first-come, first-served –Total head movement = ? –Want to reduce total seeking time or head movement: avoid “wild swings”. –Would be nice not to finish at extreme sector number.

5 Scheduling (2) Shortest seek first –For 4, 7, 16, 2, 9, 1, 9, 5, 6: After serving track 4, where do we go next? Total head movement = ? –Very good but not optimal Elevator algorithm (“scan” method) –Pick a direction and go all the way to end, then come back and handle all other requests. –Better than Shortest Seek in our example? Circular scan –Same as elevator algorithm BUT: when you reach the end you immediately go to the other end without stopping for requests. In other words, you only do work as head is moving in 1 direction. Look scheduling: modify elevator & circular scan so you only go as far as highest/lowest request

6 Disk mgmt Low-level (physical) formatting –Dividing disk medium into sectors –Besides data, sector contains error-correcting code –Later, disk controller will manipulate individual sectors High-level (logical) formatting –Record a data structure for file system on disk –Partition groups of cylinders if desired –Associate adjacent blocks into logical clusters to support file I/O “Sector sparing”: compensate for bad blocks! –Maintain list of bad blocks; replace each with a spare one Boot from disk: boot blocks in predefined locations contain system code to load  “boot partition” of drive

7 Swap space Recall: used in virtual memory to store pages evicted from RAM –Faster to return to RAM than loading from file from scratch –In effect: disk space is now being used as extension of main memory, the very essence of VM Logically a separate partition of the disk from the file system When process started, it’s given some swap space Swap map: kernel data structure to track usage –Associate an counter value with each page in swap area –0 means that page is available to swap into –Positive number: number of processes using that swapped-out data (> 1 means it’s shared data)

8 RAID Increasingly practical to have several disks on a system –But increases probability & mean time to failure RAID = “redundant array of independent disks” –Redundancy: fault tolerance technique Six “levels” or strategies of RAID: use various combinations of fault tolerant techniques Typical RAID techniques in use –Striping a group of disks: split bits of each byte across disks Or block-level striping: split blocks of a file… –Mirroring another disk –Store parity (error-correcting) bits on another disk –Leaving some disks empty until needed to replace failed disk

9 RAID levels Various combinations of techniques… For example: RAID 0 – block striping; no mirroring or parity bits RAID 1 – add mirrored disks RAID 2, 3, 4 – extra disks store parity bits –If 1 disk fails, remaining bits of each byte and error-correction bit can be used to construct lot bit of each byte. –RAID 3 – bit-interleaved parity –RAID 4 – block-interleaved parity RAID 0+1 – a set of disks is striped, and then the stripe is mirrored to another disk RAID 1+0 – disks are mirrored into a pair of disks. This pair is then striped.

10 RAID extensions RAID is designed just to detect & handle disk failure Does not prevent/detect data corruption, etc. –Could be pointing to wrong file, wrong block Checksum for data and metadata on disk –Ex. For each disk block, how many bits are set? –Store with pointer to object (See Figure 10.13) –Detect whether it has changed. Grab correct data from the mirror. RAID also somewhat inflexible because its techniques require a certain number of disks. What to do?


Download ppt "CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID."

Similar presentations


Ads by Google