mass-storage structure - cornell university9 disk structure • disk drives addressed as 1-dim...
TRANSCRIPT
![Page 1: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/1.jpg)
1
CS 4410Operating Systems
Mass-Storage Structure
Summer 2011Cornell University
![Page 2: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/2.jpg)
2
Today● How is data saved in the hard disk?● Magnetic disk● Disk speed parameters● Disk Scheduling● RAID Structure
![Page 3: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/3.jpg)
3
Secondary Storage● Save data permanently.● Slower than memory.● Cheaper and greater than memory.● Magnetic Tapes● Magnetic Disks
![Page 4: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/4.jpg)
4
Magnetic DisksThen
![Page 5: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/5.jpg)
5
Magnetic DisksNow
![Page 6: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/6.jpg)
6
Magnetic Disk: Internal
![Page 7: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/7.jpg)
7
Disk Speed• To read from disk, we must specify:
● cylinder #, surface #, sector #, transfer size, memory address
• Disk speed has two parts: – Transfer rate: the rate at which data flow between the drive and the computer.
– Positioning time:
• Seek time: the time to move the disk arm to the desired cylinder.• Rotational latency: the time for the desired sector to rotate to the disk head.
Track
Sector
Seek TimeRotational
latency
![Page 8: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/8.jpg)
8
Disks vs Memory● Smallest write: sector● Atomic write = sector● Random access: 5ms● Sequential access: 200MB/s● Cost $.002MB ● Crash: no loss (“non-
volatile”)
● (usually) bytes● byte, word● 50ns● 200-1000MB/s● $.10MB ● Contents gone (“volatile”)
![Page 9: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/9.jpg)
9
Disk Structure• Disk drives addressed as 1-dim arrays of logical blocks.
● The logical block is the smallest unit of transfer.
● Usually 512 bytes.
• This array mapped sequentially onto disk sectors.● Address 0 is 1st sector of 1st track of the outermost cylinder.
● Addresses incremented within track, then within tracks of the cylinder, then across cylinders, from outermost to innermost.
• Translation is theoretically possible, but usually difficult.● Some sectors might be defective.
● Number of sectors per track is not a constant.
![Page 10: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/10.jpg)
10
Number of sectors per track● Uniform Number of sectors per track.
● Reduce bit density per track for outer layers.
● Constant Linear Velocity.
● Typically HDDs.
● Non-uniform Number of sectors per track.
● Have more sectors per track on the outer layers.
● Increase rotational speed when reading from outer tracks.
● Constant Angular Velocity
● Typically CDs, DVDs.
![Page 11: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/11.jpg)
11
Disk Scheduling● Whenever a process needs to read or write to
the disk:● It issues a system call to the OS.● If the controller is available, the request is served.● Else, the request is placed in the pending requests
queue of the driver.● When a request is completed, the OS decides
which is the next request to service.● How does the OS make this decision? On which
criteria?
![Page 12: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/12.jpg)
12
Disk Scheduling● The OS tries to use the disk efficiently.● Target: Small access time and large
bandwidth.● The target can be achieved by managing the
order in which disk I/O requests are serviced.● Different algorithms can be used.
![Page 13: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/13.jpg)
13
FCFS● Consider a disk queue with requests for I/O to blocks on cylinders:
– 98, 183, 37, 122, 14, 124, 65, 67● The disk head is initially at cylinder 53.● Total head movement of 640 cylinders
![Page 14: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/14.jpg)
14
SSTF● Selects request with minimum seek time from current head
position● SSTF scheduling is a form of SJF scheduling
● May cause starvation of some requests.● Total head movement of 236 cylinders
![Page 15: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/15.jpg)
15
SCAN● The disk arm starts at one end of the disk.
● Moves toward the other end, servicing requests.● Head movement is reversed when it gets to the other end of disk. ● Servicing continues.
● Total head movement of 208 cylinders
![Page 16: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/16.jpg)
16
C-SCAN● Provides a more uniform wait time than SCAN.● The head moves from one end of the disk to the other.
● Servicing requests as it goes. ● When it reaches the other end it immediately returns to the beginning of
the disk.
![Page 17: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/17.jpg)
17
C-LOOK● Arm only goes as far as last request in each direction.
● Then reverses direction immediately.
![Page 18: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/18.jpg)
18
RAID Structure• Disks are improving, but not as fast as CPUs.
● 1970s seek time: 50-100 ms.● 2000s seek time: <5 ms.● Factor of 20 improvement in 3 decades
• We can use multiple disks for improving performance.• By Striping files across multiple disks (placing parts of each file on a
different disk), parallel I/O can improve access time.• Striping reduces reliability.
● 100 disks have 1/100th mean time between failures of one disk• So, we need Striping for performance, but we need something to help
with reliability / availability.• To improve reliability, we can add redundant data to the disks, in
addition to Striping
![Page 19: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/19.jpg)
19
RAID Structure
• A RAID is a Redundant Array of Independent Disks.• Disks are small and cheap, so it’s easy to put lots of disks
in one box for increased storage, performance, and availability.
• Data plus some redundant information is Striped across the disks in some way.
![Page 20: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/20.jpg)
20
Raid Level 0• Level 0 is non-redundant disk array.• Files are Striped across disks, no redundant info.• High read throughput.• Best write throughput (no redundant info to write).• Any disk failure results in data loss.
Stripe 0
Stripe 4
Stripe 3Stripe 1 Stripe 2
Stripe 8 Stripe 10 Stripe 11
Stripe 7Stripe 6Stripe 5
Stripe 9
data disks
![Page 21: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/21.jpg)
21
Raid Level 1• Mirrored Disks• Data is written to two places.
● On failure, just use surviving disk.
• On read, choose fastest to read.● Write performance is same as single drive, read performance is 2x better.
• Expensive
data disks mirror copies
Stripe 0
Stripe 4
Stripe 3Stripe 1 Stripe 2
Stripe 8 Stripe 10 Stripe 11
Stripe 7Stripe 6Stripe 5
Stripe 9
Stripe 0
Stripe 4
Stripe 3Stripe 1 Stripe 2
Stripe 8 Stripe 10 Stripe 11
Stripe 7Stripe 6Stripe 5
Stripe 9
![Page 22: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/22.jpg)
22
Raid Level 2• Bit-level Striping with ECC codes for error correction.• All 7 disk arms are synchronized and move in unison.• Complicated controller.• Single access at a time.• Tolerates only one error, but with no performance degradation.
data disks
Bit 0 Bit 3Bit 1 Bit 2 Bit 4 Bit 5 Bit 6
ECC disks
![Page 23: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/23.jpg)
23
Raid Level 3• Use a parity disk.
● Each bit on the parity disk is a parity function of the corresponding bits on all the other disks.
• A read accesses all the data disks.• A write accesses all data disks plus the parity disk.• On disk failure, read remaining disks plus parity disk to compute the missing
data.
data disksParity disk
Bit 0 Bit 3Bit 1 Bit 2 Parity
![Page 24: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/24.jpg)
24
Raid Level 4• Combines Level 0 and 3 – block-level parity with Stripes.• A read accesses all the data disks.• A write accesses all data disks plus the parity disk.• Heavy load on the parity disk.
data disksParity disk
Stripe 0 Stripe 3Stripe 1 Stripe 2 P0-3
Stripe 4
Stripe 8 Stripe 10 Stripe 11
Stripe 7Stripe 6Stripe 5
Stripe 9
P4-7
P8-11
![Page 25: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/25.jpg)
25
Raid Level 5• Block Interleaved Distributed Parity.• Like parity scheme, but distribute the parity info over all disks (as well as data
over all disks).• Better read performance, large write performance.
data and parity disks
Stripe 0 Stripe 3Stripe 1 Stripe 2 P0-3
Stripe 4
Stripe 8 P8-11 Stripe 10
P4-7Stripe 6Stripe 5
Stripe 9
Stripe 7
Stripe 11
![Page 26: Mass-Storage Structure - Cornell University9 Disk Structure • Disk drives addressed as 1-dim arrays of logical blocks. The logical block is the smallest unit of transfer. Usually](https://reader033.vdocuments.net/reader033/viewer/2022060521/604f98b476421164cf1fe50a/html5/thumbnails/26.jpg)
26
Today● How is data saved in the hard disk?● Magnetic disk● Disk speed parameters● Disk Scheduling● RAID Structure