180 likes | 263 Views
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems {week 15}. I/O system. The Input/Output (I/O) System has two primary objectives: Handle application I/O requests Map logical address to physical disk or device address
E N D
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems{week 15}
I/O system • The Input/Output (I/O) System has two primary objectives: • Handle application I/O requests • Map logical address to physical disk or device address • Send response back to the application • Optimize I/O performance • Depends on request type and device type
Disk drives & the disk controller • Disks and other devices operate in parallel to the CPU (but are much slower) • Typical diskdrive mechanism: • Arm seeks to theappropriate track • Disk rotates untilthe desired sectoris accessed
Disk access time • Disk access time is the sumof the seek time and therotational latency • Cache surroundingsectors or entire trackto improve performance • Principle of locality (again!)
I/O performance optimization (i) • Disk access times are orders of magnitude slower than CPU execution times • Improve I/O performance by: • Reducing the number of I/O requests • Implementing buffering • Implementing caching • Efficiently scheduling I/O requests do this at theapplication layer
I/O performance optimization (ii) • Use buffering to makephysical I/O requestsas large as possible • This reduces thenumber of I/O requests • Space-time tradeoff • Misleads programmers? • Other disadvantages?
I/O performance optimization (iii) • Use caching to keep retrieved datain fast memory for potentialfuture access • Eliminates one or moreI/O requests • Space-time tradeoff • Principle of locality (yet again!)
Disk context switch • A disk context switch occurs when switching from one I/O request to another • Disk context switch time is substantially higherthan process context switch • Disk context switch time is substantially lowerthan disk read/write operation • The time to complete the nth I/O operation depends on where the (n-1)th operation finished
Disk I/O scheduling maximize throughput, ensure fairness, etc. • Goal: optimize disk performance • Scheduling algorithm determines which pending disk I/O request to select next: • First-Come-First-Served (FCFS) • Shortest Seek Time First (SSTF) • Elevator (SCAN) and Circular SCAN (C-SCAN)
First-come-first-served (FCFS) • Request reference string specifies requested tracks: 44, 20, 95, 4, 50, 52, 47, 61, 87, 25
First-come-first-served (FCFS) • Request reference string specifies requested tracks: 98, 183, 37, 122, 14, 124, 65, 67
Shortest seek time first (SSTF) • Request reference string specifies requested tracks: 44, 20, 95, 4, 50, 52, 47, 61, 87, 25
Shortest seek time first (SSTF) • Request reference string specifies requested tracks: 98, 183, 37, 122, 14, 124, 65, 67
Elevator (SCAN) • Request reference string specifies requested tracks: 44, 20, 95, 4, 50, 52, 47, 61, 87, 25 repeated end-to-end scans
Elevator (SCAN) • Request reference string specifies requested tracks: 98, 183, 37, 122, 14, 124, 65, 67
Circular SCAN and LOOK • Circular SCAN (C-SCAN) scans in one direction • When it reaches one end of the disk, it returnsto the beginning of the disk without servicingany requests on the return trip • LOOK (and C-LOOK) algorithms • Disk arm moves in one direction as long asthere are pending requests in that direction • Otherwise, it reverses direction immediately