Presentation is loading. Please wait.

Presentation is loading. Please wait.

Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure.

Similar presentations


Presentation on theme: "Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure."— Presentation transcript:

1 Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure

2 10.2 Chapter 10: Mass-Storage Systems Overview of Mass Storage Structure Disk Structure Disk Attachment Disk Scheduling Disk Management Swap-Space Management Operating System Support Performance Issues

3 10.3 Objectives Describe the physical structure of secondary and tertiary storage devices and the resulting effects on the uses of the devices Explain the performance characteristics of mass-storage devices

4 10.4 Magnetic Disks Magnetic disks are most common secondary storage of modern computers Both sides of disk platter covered with magnetic material All platters of drive connected to spindle, rotate at 60 to 200 times per second (7200rpm = 120 rotations per second) Read-write head moves just microns above the disks  Head crash: if it touches the disk; sectors (sometimes entire disk) is ruined Arm assembly move all heads of drive along radius of disks

5 10.5 Magnetic Disks Each platter is divided in concentric tracks Each track divided in sectors A vertical set of tracks among all disks is a cylinder All disks rotate as one by the spindle and all heads move as one by the arm assembly Drive reads one track/sector on the entire cylinder at once

6 10.6 Magnetic Disks You want to read track t sector s Seek time: time needed to move the head to the desired track Rotational latency: time needed for disk to rotate to desired sector Positioning time (random access time): seek time + rotational latency (several milliseconds) Transfer rate: rate to move data between drive and rest of system (megabytes per second)

7 10.7 Magnetic Disks Drive attached to computer via I/O bus Commands from rest of computers sent to a host controller, through I/O bus to disk controller built into drive I/O bus transfer much faster than transfer rate: disk controller has cache Data transfers from disk to cache to I/O bus

8 10.8 Other Mass Storage Devices Punch card Paper cards, each hole is a bit Reading head closes a circuit (through the hole) or not (if no hole) Actually predates computers! Tape drive Large-storage-capacity but slow-access-time magnetic tapes Forward or rewind to desired information ROM Cartridge Portable ROM physically connected to system bus and mapped into system’s memory address space Floppy disk (8-inch, 5¼-inch, 3½-inch, zip) Miniature flexible portable magnetic disks Optical disk (CD, DVD, Blu-Ray) Reflective disks (instead of magnetic): reflection is 1, absorption is 0 Laser read-write head Typically read-only or write-once Solid-state drive (SSD, flash drives) Electronic (transistor and logic gates) storage (instead of magnetic or reflective) No moving parts: random access time in microseconds!

9 10.9 Disk Structure Disk sectors are of constant data size (normally 512 bytes) But outer tracks are physically larger than inner ones Bit density: number of bits per physical area We want to keep data transfer rate constant Constant linear velocity Keep bit density constant on drive  Result: physically larger tracks hold more sectors Increase speed for inner tracks  Read same number of sectors per unit of time Method used in CDs and DVDs Constant angular velocity Increase bit density for inner tracks  Result: same number of sectors in outer and inner tracks Keep rotation speed constant Method used in HDD

10 10.10 Disk Scheduling Processes make requests for information on disk OS responsible for using the disk efficiently Maximize bandwidth: amount of data transferred divided by time needed to complete all requests Maximized by handling requests as efficiently as possible Bandwidth has multiple components Positioning time (seek time + rotational latency) Read/write time for the head (constant) Transfer rate (constant) Maximize bandwidth = minimize seek time Seek time  seek distance

11 10.11 Disk Scheduling Several algorithms exist to schedule the servicing of disk I/O requests We can compare them by using a reference string of requests Requested sectors: 98, 183, 37, 122, 14, 124, 65, 67 Initial read-write head position: 53

12 10.12 FCFS First-Come-First-Serve: Service each request in the order it arrives Easiest to implement Total seek distance: 640 cylinders

13 10.13 SSTF Shortest-Seek-Time-First: Select the request with the minimum seek time from the current head position Can cause starvation Total seek distance: 236 cylinders

14 10.14 SCAN algorithm (elevator algorithm): move the head back and forth from one end of the disk to the other, and service requests as you get to them No chance of starvation Total seek distance: 236 cylinders SCAN

15 10.15 C-SCAN Circular-SCAN (C-SCAN) algorithm: move the head from one end of the disk to the other, and service requests as you get to them, then jump back to the beginning and start again Total seek distance: 382 cylinders But actually more efficient than SCAN!

16 10.16 C-LOOK C-LOOK algorithm: variant of C-SCAN that goes to the last request rather than the end and beginning of the disk Total seek distance: 322 cylinders

17 10.17 Disk Scheduling So which scheduling algorithm is best? Depends on the number and types of requests… and on the file- allocation method! Number of requests Very few requests: SSTF and C-Look reduce to FCFS due to lack of choice, SCAN and C-SCAN are very inefficient Lots of requests: SCAN and C-SCAN more efficient & avoid starvation File-allocation method Contiguous allocation results in lots of nearby requests: FCFS can work Linked or indexed allocation results in scattered requests: FCFS is pretty bad Location of directory entries vs. files FAT: entry at the beginning of disk, file in data region = large disk seek UFS: inode before each file = contiguous requests

18 10.18 Disk Scheduling Types of requests OS differentiates between read & writes, pages & files Swapping pages given priority over file I/O (especially during page faults) Writing data to files given priority over reading when cache is near full Default choice given no info? Typically SSTF or C-LOOK

19 10.19 Disk Formatting When a new magnetic disk is built, it’s just a slab of magnetic material Low-level formatting (physical formatting) Dividing a disk into sectors that the disk controller can read and write A sector has A data section (256 to 1024 bytes, typically 512) A header and trailer An error-correcting code (ECC) that allows the controller to automatically detect and correct a few bits wrong Logical formatting Creating the file-system data and structures Marking all sectors as free space

20 10.20 Bad Blocks All disks have unusable bad blocks IDE disks on MS-DOS Bad blocks detected manually by disk formatting or scanning tools (format and chkdsk) OS writes special value in FAT to make them unusable Information in sector lost SCSI disks: sector forwarding Controller (not OS) handles the bad block list Low-level formatting sets aside spare sectors not visible to OS When a bad sector is found, it is substituted for a spare sector  Information is recovered and copied thanks to ECC SCSI disks: sector slipping Like forwarding, but move all sectors down one spot to keep sector order Sector 17 (bad) and sector 200 (spare), so 199 copied to 200, 198 copied to 199, …, 18 copied to 19, 17 copied to 18

21 10.21 Swap-Space Management Middle-term schedule swaps information between memory and disk Swap-space size Swap pages to free a few frames (needs several KB to a few MB) Swap entire processes to free lots of memory (needs several GB) Solaris estimates swap space as difference between virtual memory and physical memory, Linux as 2x physical memory space Swap-space location One large file allocated in the file system  Can be expanded just like any file  Need to access through the file system: slower Raw partition managed by OS  Managed for speed rather than efficient storage  Can suffer from fragmentation, but ok because data is short-lived  Expanding it requires repartitioning drive

22 10.22 Review Given a magnetic disk with multiple platters, each with its own read-write head, is it possible to read sectors on different cylinders on different platters at the same time? How can the file system used on a disk affect our choice of a scheduling algorithm?

23 10.23 Exercises Skip the following sections: 10.3 (Disk Attachment), 10.7 (RAID Structure), and 10.8 (Stable Storage Implementation) If you have the “with Java” textbook, skip the Java sections and subtract 1 to the following section numbers 10.1 10.2 10.3 10.5 10.9 10.10 10.11 10.14 10.15 10.16 10.21 10.22

24 Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, End of Chapter 10


Download ppt "Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 10: Mass-Storage Structure."

Similar presentations


Ads by Google