Multiprocessor Memory Allocation
Download
Report
Transcript Multiprocessor Memory Allocation
Operating Systems
CMPSCI 377
Lecture 18: Storage Systems
Emery Berger
University of Massachusetts, Amherst
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
Last Time:
Improving I/O Performance
Approaches:
Caching – reduces data transfer
Large data transfers
DMA
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
2
Today
Improving performance of storage systems
(i.e., the disk)
Scheduling
Interleaving
Read-ahead
Tertiary storage
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
3
Disk Operations
Disks are SLOW!
Latency:
1 disk seek = 40,000,000 cycles
Seek – position head over track/cylinder
Rotational delay – time for sector to rotate
underneath head
Bandwidth:
Transfer time – move bytes from disk to
memory
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
4
Calculating Disk Operations Time
Read/write n bytes:
I/O time = seek + rotational delay + transfer(n)
Can’t reduce transfer time
Can we reduce latency?
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
5
Reducing Latency
Minimize seek time & rotational latency:
Smaller disks
Faster disks
Sector size tradeoff
Scheduling
Layout
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
6
Disk Head Scheduling
Change order of disk accesses
Reduce length & number of seeks
Algorithms
FCFS
SSTF
SCAN, C-SCAN
LOOK, C-LOOK
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
7
I/O time = seek + rotational delay + transfer(n)
FCFS
First-come, first-serve
Example: disk tracks – (65, 40, 18, 78)
18
assume head at track 50
40
65
78
disk
Total seek time?
15+25+22+60 = 122
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
8
I/O time = seek + rotational delay + transfer(n)
SSTF
Shortest-seek-time first (like SJF)
Example: disk tracks – (65, 40, 18, 78)
18
assume head at track 50
40
65
78
disk
Total seek time?
10+22+47+13 = 92
Is this optimal?
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
9
I/O time = seek + rotational delay + transfer(n)
SCAN
Always move back and forth across disk
a.k.a. elevator
Example: disk tracks – (65, 40, 18, 78)
18
assume head at track 50, moving forwards
40
65
78
disk
Total seek time?
15+13+22+60+22=132
When is this good?
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
10
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)
18
assume head at track 50, moving forwards
40
65
78
disk
Total seek time?
15+13+22+100+18+40=208
Can be expensive, but more fair
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
11
LOOK variants
Instead of going to end of disk,
go to last request in each direction
SCAN, C-SCAN ) LOOK, C-LOOK
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
12
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
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
13
Solutions
FCFS
SSTF
143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86 – distance: 3,319
C-SCAN
143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86 – distance: 9,769
LOOK
143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774 – distance: 1,745
SCAN
143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 – distance: 7,081
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
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
14
Today
Improving performance of storage systems
(i.e., the disk)
Scheduling
Interleaving
Read-ahead
Tertiary storage
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
15
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
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
16
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?
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
17
Tertiary Storage
a.k.a. long-term storage
Examples:
disks = secondary storage
used for archival data or backups
tape drives
CD-R, DVD-R/W
Performance still somewhat important
not much OS can do
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
18
Summary
OS can improve storage system performance
Scheduling
Interleaving
Read-ahead
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
19