Operating Systems Lecture Notes
2014 November 4 • Mass Storage
Outline
Disk Operation
The OS issues a sequence of (start, len) requests to the disk.
The disk services the requests
to satisfy the given requests
in a way satisfying various criteria.
The principle criteria is
service time
: the elapsed time from request issue to request completion.
Minimal service time, or predictable service time, or …
Disk Economics
Disk service time has three components:
Seek time
: moving the disk head to the proper cylinder.
Rotational latency
: moving the sector under the disk head.
Transfer time
: moving the bits to or from the sector.
Transfer time is fixed, and rotational latency mostly fixed these days.
Seek time is the component to influence.
Request Scheduling
Given a set of disk I-O requests, issue them to provide minimal service times.
That is, to minimize seek times.
The
Request
(or
disk
)
scheduler
is responsible for ordering requests.
Request scheduling is moving from the OS to the disk controller.
Shortest Seek Time First
Minimize disk-head movement.
The request serviced next is closest to the disk head.
Shortest Seek Time First
(
SSFT
)
scheduling
.
Similar to shortest-job next process scheduling.
Like SJN, may starve requests; not optimal.
Scan
The disk head
scans
from one disk edge to the other.
Service the request closest to the disk head in the scan direction:
Scan
(or
Elevator
)
scheduling
.
No starvation, but uneven service times.
One request just before the disk head, one just behind.
Circular Scan
Scan, but service requests in only one direction.
The return scan goes edge to edge without stopping.
Reduced variability, relatively and absolutely.
Circular-scan
(or
C-scan
)
scheduling
.
Cylinders are a circular list.
Look-Ahead
Stop scanning to an edge if there are no requests in that direction.
Reverse and scan to the other edge.
Look scheduling
.
C-look scheduling
: scan back when there's no forward requests.
In either case, less arm movement, saving time.
Which Scheduler?
Properties: starvation, performance.
SSTF scheduling performs well (small movements) but can starve requests.
Other schedulers don't starve requests.
Performance is demand-dependent.
Correlated or random requests.
Demand-adaptive schedulers
Modify SSFT with aging.
Disk Management
From disk to sectors, tracks and cylinders.
Higher-level disk structures are helpful.
The
boot sector
.
ROM-based
boot code
executes on power-up.
Boot code reads disk sector 0 into primary store, and executes it.
Boot-sector code takes over initialization.
Boot sector written during OS install.
Disk Partitions
A
disk partition
is a contiguous sequence of disk cylinders.
The rest of the system treats a partition is a
virtual disk
.
Partitions improve reliability and performance.
Catastrophic disk failures wipe-out only the containing partition(s).
Special-purpose access and use can be segregated to a partition.
Swap Space
Pages get written to swap space when paged out.
Swap space
is a disk partition or a file.
“Special” due to performance demands and access patterns.
Swap space is an array of page slots.
Each page slot a small multiple of the page size.
Swap Management
Swap space can be allocated dynamically or statically.
Static allocation done at process load-time.
Safe but wasteful.
Dynamic allocation done at page-out time.
Space-efficient but unsafe.
The swap map keeps track of allocated-available swap space.
Summary
References
This page last modified on 2011 October 9.