Download presentation
1
Disks and Storage Systems
CSE451 Andrew Whitaker How is the disk abstraction different than memory?
2
Big Picture OS provides abstractions to allow physical HW resources to be shared CPU sharing with threads Memory sharing with virtual memory Disk sharing with files
3
Physical disk structure
Disk components platters surfaces tracks sectors cylinders arm heads sector track surface cylinder platter arm head
4
Disk Interface (as seen from the OS)
Disk exposes a contiguous array of logical block numbers Internally, the disk maps these to cylinder, head, sector
5
Disk Size and Cost Cost per gigabyte has plummeted
Now approximately $ .33 per Gigabyte
6
Disk trends Disk capacity, 1975-1989 Disk capacity since 1990
doubled every 3+ years 25% improvement each year factor of 10 every decade exponential, but far less rapid than processor performance Disk capacity since 1990 doubling every 12 months 100% improvement each year factor of 1000 every decade 10x as fast an improvement as processor performance!
7
Components of Disk Access Latency
Seek time: moving the disk arm to the correct cylinder Rotation time: waiting for the sector to rotate under head Depends on rotation rate of disk Transfer time: transferring data from surface into disk controller, and from there into main memory Of these, only transfer time is getting better
8
Implications of Disk Performance
Large transfers are faster (per byte) than small transfers Contiguous transfers are faster than scattered transfers Contiguous transfer rate is 500X random access rate
9
Disk Partitions Each physical disk can be split into logical disks, called partitions Partition 1 Partition 2 Partition 3 Partition table provides sizes, types Located in the first disk sector Master Boot Record
10
Disks and File Systems Each partition can contain a file system
Examples: NTFS, ext3, FFS UNIX mount command shows file system partition mapping /dev/sda2 on / type ext3 (rw) /dev/sda5 on /usr type ext3 (rw,nodev) /dev/sda6 on /var type ext3 (rw,nosuid,nodev) /dev/sda7 on /tmp type ext3 (rw,nosuid,nodev) proc on /proc type proc (rw)
11
Accessing the Disk Disk access is provided by a block device driver
Provides a function to enqueue a request Privileged User Apps File Systems Enqueue request Device Driver Read/write sectors Disk
12
What Happens on Enqueue Request?
OS maps from <partition, offset> to a logical block number Make sure the offset is in bounds! The request is added to a pending request queue Common optimization: clustering If the request is adjacent (on disk) to another request, merge them Request scheduling OS chooses an order for pending requests (see next slides) Once the device is free, the device driver dispatches one or more pending requests
13
Disk Scheduling Problem: Given a set of pending disk requests, choose an ordering Goals (Quite possibly conflicting) Maximize throughput Minimize waiting Provide fairness Avoid starvation
14
Policy #1: First-come, First-serve
Disk requests are dispatched in the order they arrive Performance of FCFS is highly dependent on the workload Performs well if disk requests arrive in contiguous order Performs poorly if requests arrivals are scattered across disk
15
Policy #2: Shortest-seek-time-first
Schedule the request that is closest to the current head position Advantage: much better performance than FCFS Disadvantage: bias, starvation Requests in the middle cylinders get better service Requests in outer cylinders can starve
16
Policy #3: SCAN Scheduling
Head continuously moves back and forth across the disk Sometimes called “elevator algorithm” Advantages: starvation-free, reasonable performance, easy to implement (sort)
17
Looking Ahead: File Systems
One proposal: use disk partitions for files Use one disk partition per file Is this a good idea? Why or why not? foo.txt bar.txt zag.txt
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.