Download Lecture 11: Disk I/O - Understanding Secondary Storage - Prof. Geoffrey M. Voelker and more Study notes Computer Science in PDF only on Docsity! 1 Lecture 11: Disk I/O Geoffrey M. Voelker November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 2 The next topic that we will cover is secondary storage Disk I/O (today) File systems (next time) 2 November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 3 CPU Cache Memory Bus Main Memory I/O Bridge I/O Bus Disk Controller Display Controller Ethernet Controller November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 4 Secondary storage is usually: Anything outside of “primary memory” Anything that does not permit direct instruction execution or data fetch via machine load/store instructions Characteristics It’s large – hundreds of megabytes, gigabytes, terabytes It’s cheap – 100 GB IDE disks cost $256 It’s persistent – data survives loss of power It’s slow – milliseconds to access (why is a millisecond slow?) 5 November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 9 " Specifying disk requests requires a lot of info: Cylinder #, surface #, track #, sector #, transfer size… Older disks required the OS to specify all of this The OS needed to know all disk parameters Modern disks are more complicated Not all sectors are the same size, sectors are remapped, etc. Current disks provide a higher-level interface (SCSI) The disk exports its data as a logical array of blocks [0…N] » Disk maps logical blocks to cylinder/surface/track/sector Only need to specify the logical block # to read/write But now the disk parameters are hidden from the OS November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 10 " $%%%& IBM Ultrastar 36XP drive Form factor: 3.5” Capacity: 36.4 GB Rotation rate: 7,200 RPM Platters: 10 Surfaces: 20 Sector size: 512-732 bytes Cylinders: 11,494 Cache: 4MB Transfer rate: 17.9 MB/s (inner) – 28.9 MB/s (outer) Full seek: 14.5 ms Head switch: 0.3 ms 6 November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 11 " Disk request performance depends upon a number of steps Seek – moving the disk arm to the correct cylinder » Depends on how fast disk arm can move (increasing very slowly) Rotation – waiting for the sector to rotate under the head » Depends on rotation rate of disk (increasing, but slowly) Transfer – transferring data from surface into disk controller electronics, sending it back to the host » Depends on density (increasing quickly) When the OS uses the disk, it tries to minimize the cost of all of these steps Particularly seeks and rotation November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 12 " # Because seeks are so expensive (milliseconds!), the OS tries to schedule disk requests that are queued waiting for the disk FCFS (do nothing) » Reasonable when load is low » Long waiting times for long request queues SSTF (shortest seek time first) » Minimize arm movement (seek time), maximize request rate » Favors middle blocks SCAN (elevator) » Service requests in one direction until done, then reverse C-SCAN » Like SCAN, but only go in one direction (typewriter) 7 November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 13 " # $& In general, unless there are request queues, disk scheduling does not have much impact Important for servers, less so for PCs Modern disks often do the disk scheduling themselves Disks know their layout better than OS, can optimize better Ignores, undoes any scheduling done by OS November 7, 2001 CSE 120 – Lecture 11 – Disk I/O 14 # I/O overview Memory hierarchy Secondary storage Large, persistent, but slow Disks Physical structure Interface Performance Scheduling