190 likes | 208 Views
Operating Systems CMPSCI 377 Lecture 18: Storage Systems. Emery Berger University of Massachusetts, Amherst. Last Time: Improving I/O Performance. Approaches: Caching – reduces data transfer Large data transfers DMA. Today. Improving performance of storage systems (i.e., the disk)
E N D
Operating SystemsCMPSCI 377Lecture 18: Storage Systems Emery Berger University of Massachusetts, Amherst
Last Time:Improving I/O Performance • Approaches: • Caching – reduces data transfer • Large data transfers • DMA
Today • Improving performance of storage systems (i.e., the disk) • Scheduling • Interleaving • Read-ahead • Tertiary storage
Disk Operations • Disks are SLOW! • 1 disk seek = 40,000,000 cycles • Latency: • Seek – position head over track/cylinder • Rotational delay – time for sector to rotate underneath head • Bandwidth: • Transfer time – move bytes from disk to memory
Calculating Disk Operations Time • Read/write n bytes: • Can’t reduce transfer time • Can we reduce latency? I/O time = seek + rotational delay + transfer(n)
Reducing Latency • Minimize seek time & rotational latency: • Smaller disks • Faster disks • Sector size tradeoff • Scheduling • Layout
Disk Head Scheduling • Change order of disk accesses • Reduce length & number of seeks • Algorithms • FCFS • SSTF • SCAN, C-SCAN • LOOK, C-LOOK
FCFS I/O time = seek + rotational delay + transfer(n) • First-come, first-serve • Example: disk tracks – (65, 40, 18, 78) • assume head at track 50 • Total seek time? • 15+25+22+60 = 122 18 65 78 40 disk
SSTF I/O time = seek + rotational delay + transfer(n) • Shortest-seek-time first (like SJF) • Example: disk tracks – (65, 40, 18, 78) • assume head at track 50 • Total seek time? • 10+22+47+13 = 92 • Is this optimal? 18 65 78 40 disk
SCAN I/O time = seek + rotational delay + transfer(n) • Always move back and forth across diska.k.a. elevator • Example: disk tracks – (65, 40, 18, 78) • assume head at track 50, moving forwards • Total seek time? • 15+13+22+60+22=132 • When is this good? 18 65 78 40 disk
C-SCAN I/O time = seek + rotational delay + transfer(n) • Circular SCAN:Go back to start of disk after reaching end • Example: disk tracks – (65, 40, 18, 78) • assume head at track 50, moving forwards • Total seek time? • 15+13+22+100+18+40=208 • Can be expensive, but more fair 18 65 78 40 disk
LOOK variants • Instead of going to end of disk,go to last request in each direction • SCAN, C-SCAN ) LOOK, C-LOOK
Exercises • 5000 cylinders, currently at 143, moving forwards(86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 ) • FCFS • SSTF • SCAN • LOOK • C-SCAN • C-LOOK • Find sequence & total seek time • First = 0, last = 4999
Solutions • FCFS • 143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 – distance: 7,081 • SSTF • 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774 – distance: 1,745 • SCAN • 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86 – distance: 9,769 • LOOK • 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86 – distance: 3,319 • C-SCAN • 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 0, 86, 130 – distance: 9,813 • C-LOOK • 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 86, 130 – distance: 3,363
Today • Improving performance of storage systems (i.e., the disk) • Scheduling • Interleaving • Read-ahead • Tertiary storage
Disk Interleaving • Contiguous allocation • Requires OS response before disk spins past next block • Instead of physically contiguous allocation,interleave blocks • Relative to OS speed, rotational speed
Read-Ahead • Reduce seeks by reading blocks from disk ahead of user’s request • Place in buffer on disk controller • Similar to pre-paging • Easier to predict future accesses on disk?
Tertiary Storage • a.k.a. long-term storage • disks = secondary storage • used for archival data or backups • Examples: • tape drives • CD-R, DVD-R/W • Performance still somewhat important • not much OS can do
Summary • OS can improve storage system performance • Scheduling • Interleaving • Read-ahead