Chapter 11: Mass-Storage Systems
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 11: Mass-Storage Systems Operating System Concepts – 10th dition Silberschatz, Galvin and Gagne ©2018 Chapter 11: Mass-Storage Systems Overview of Mass Storage Structure HDD Scheduling NVM Scheduling Error Detection and Correction Storage Device Management Swap-Space Management Storage Attachment AID Structure Operating System Concepts – 10th dition 11!2 Silberschatz, Galvin and Gagne ©2018 Objectives Describe the physical structure of secondary storage devices and the e$ect of a device’s structure on its uses Explain the performance characteristics of mass-storage devices Evaluate I/O scheduling algorithms Discuss operating-s#stem services provided for mass storage( including AID Operating System Concepts – 10th dition 11!" Silberschatz, Galvin and Gagne ©2018 Overview of Mass Storage Structure Bulk of secondary storage for modern computers is hard disk drives +%&Ds, and nonvolatile memory +'(), devices %DDs spin platters of magnetically-coated material under moving read- write heads Drives rotate at 60 to 250 times per second Transfer rate is rate at which data flow between drive and computer Positioning time +random-access time) is time to move dis* arm to desired cylinder +seek time) and time for desired sector to rotate under the disk head (rotational latency, %ead crash results from disk head making contact with the disk surface -- That%s bad Disks can be removable Operating System Concepts – 10th dition 11!# Silberschatz, Galvin and Gagne ©2018 Moving-head Disk Mechanism Operating System Concepts – 10th dition 11!. Silberschatz, Galvin and Gagne ©2018 Hard Disk Drives Platters range from 4506 to 786 (historically, Commonl# 9406( /406( and 7456 ange from 9.:B to 92B per drive Performance 2ransfer ate – theoretical ; 6 :"'sec Effective 2ransfer ate – real – 7:"'sec Seek time from 3ms to 12ms ; 9ms common for des*top drives Average see* time measured or calculated based on 7'3 of trac*s Latenc# based on spindle speed 1 ' + PM ' -0) = -. ' PM Average latenc# > ? latenc# Operating System Concepts – 10th dition 11!/ Silberschatz, Galvin and Gagne ©2018 Hard Disk Performance Access Latency > 1verage access time > average seek time + average latenc# For fastest disk 3ms + 2ms = 5ms For slow disk 9ms @ 5.56ms > 14406ms Average I/O time > average access time @ (amount to transfer / transfer rate) + controller overhead Aor example to transfer a 4KB block on a 7200 RPM disk with a 5ms average seek time, 7:"'sec transfer rate with a .7ms controller overhead > 5ms + 4.17ms @ .47ms @ transfer time = Transfer time = 4KB / 1Gb/s * 8Gb / GB * 1GB / 10/8/KB = 9/ / +7./8/, = .4.31 ms Average I/O time for 4KB block = 9.27ms @ 4.97ms = <49.1ms Operating System Concepts – 10th dition 11!0 Silberschatz, Galvin and Gagne ©2018 The First Commercial Disk Drive 1956 IBM RAMDAC computer included the IBM Model 350 disk storage system 5M (7 bit) characters 50 x 24” platters Access time = < 1 second Operating System Concepts – 10th dition 11!8 Silberschatz, Galvin and Gagne ©2018 Nonvolatile Memory Devices !f dis*-drive like, then called solid-state disks +SSDs) Other forms include USB drives (thumb drive, flash drive), DRAM dis* replacements, surface-mounted on motherboards, and main storage in devices like smartphones Can be more reliable than HDDs More expensive per M) Maybe have shorter life span – need careful management Less capacit# But much faster Busses can be too slow -> connect directly to PCI for example No moving parts, so no seek time or rotational latency Operating System Concepts – 10th dition 11!3 Silberschatz, Galvin and Gagne ©2018 Nonvolatile Memory Devices Have characteristics that present challenges ead and written in “page” increments (think sector) "ut can’t overwrite in place Must first be erased, and erases happen in larger ”block” increments Can only be erased a limited number of times before worn out – ~ 10.(... =ife span measured in drive writes per day +&7,&, A 1TB NAND drive with rating of 0DWPD is expected to have 02B per day written within warrantee period without failing Operating System Concepts – 10th dition 11!10 Silberschatz, Galvin and Gagne ©2018 NAND Flash Controller Algorithms With no overwrite( pages end up with mix of valid and invalid data To track which logical blocks are valid( controller maintains flash translation layer +9*2) table Also implements garbage collection to free invalid page space Allocates overprovisioning to provide working space for GC Each cell has lifespan, so wear leveling needed to write equally to all cells NAND block with valid and invalid pages Operating System Concepts – 10th dition 11!11 Silberschatz, Galvin and Gagne ©2018 Volatile Memory DRAM freJuently used as mass-storage device Not technicall# secondary storage "ecause volatile( "ut can have file systems, "e used like ver# fast secondar# storage :1) drives +with many names, including RAM disks) present as raw "lock devices( commonly file system formatted Computers have "u$ering( caching via RAM( so why RAM drives? Caches ' "u$ers allocated ' managed "# programmer( operating system( hardware RAM drives under user control Aound in all major operating systems =inux /dev/ram( macOS diskutil to create them( =inu& /tmp of file system type tmpfs Used as high speed temporary storage 3rograms could share "ul* date( Juickl#( "y reading'writing to RAM drive Operating System Concepts – 10th dition 11!12 Silberschatz, Galvin and Gagne ©2018 Magnetic Tape Operating System Concepts – 10th dition 11!1" Silberschatz, Galvin and Gagne ©2018 Disk Attachment Host-attached storage accessed through !'O ports tal*ing to ;<O b=sses Several "usses availa"le( including advanced technology attachment +1*1,( serial 1*A +S1*1,( eS1*1( serial attached SCS; +SAS,( =niversal serial b=s +US5,( and >bre channel +9C,4 Most common is SA2A )ecause NVM much faster than HDD, new fast interface for NVM called '() e?press +'()e,( connecting directl# to 3C! "us Data transfers on a "us carried out "# special electronic processors called controllers +or host-b=s adapters( %51s, Host controller on the computer end of the "us( device controller on device end Computer places command on host controller( using memor#-mapped !'O ports Host controller sends messages to device controller Data transferred via DMA "etween device and computer DRAM Operating System Concepts – 10th dition 11!1. Silberschatz, Galvin and Gagne ©2018 Address Mapping Disk drives are addressed as large 1-dimensional arrays of logical blocks( where the logical block is the smallest unit of transfer =ow-level formatting creates logical blocks on physical media 2he 1-dimensional array of logical bloc*s is mapped into the sectors of the disk sequentiall# Sector 0 is the Grst sector of the first track on the outermost cylinder Mapping proceeds in order through that track( then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost =ogical to physical address should be eas# Except for bad sectors Non-constant # of sectors per track via constant angular velocit# Operating System Concepts – 10th dition 11!1/ Silberschatz, Galvin and Gagne ©2018 HDD Scheduling 2he operating system is responsible for using hardware efficientl# — for the disk drives, this means having a fast access time and disk "andwidth Minimize seek time See* time seek distance Dis* bandwidth is the total number of "#tes transferred, divided by the total time between the first request for service and the completion of the last transfer Operating System Concepts – 10th dition 11!10 Silberschatz, Galvin and Gagne ©2018 Disk Scheduling (Cont.) There are many sources of disk !/O request OS System processes Msers processes !'O request includes input or output mode, disk address( memory address, number of sectors to transfer OS maintains queue of requests, per dis* or device !dle disk can immediately work on I/O request, busy dis* means work must Jueue Optimization algorithms only make sense when a queue exists !n the past( operating system responsible for queue management, disk drive head scheduling Now, built into the storage devices( controllers Just provide LBAs, handle sorting of requests Some of the algorithms they use described next Operating System Concepts – 10th dition 11!18 Silberschatz, Galvin and Gagne ©2018 Disk Scheduling (Cont.) Note that drive controllers have small "uffers and can manage a Jueue of I/O requests (of varying Fdepth6, Several algorithms exist to schedule the servicing of disk I/O requests The analysis is true for one or many platters We illustrate scheduling algorithms with a request queue (.-19<, <8, 183( 37( 122, 74, 724, 65, 67 Head pointer 53 Operating System Concepts – 10th dition 11!13 Silberschatz, Galvin and Gagne ©2018 FCFS Illustration shows total head movement of 640 cylinders Operating System Concepts – 10th dition 11!20 Silberschatz, Galvin and Gagne ©2018 SCAN The dis* arm starts at one end of the disk, and moves toward the other end( servicing requests until it gets to the other end of the dis*( where the head movement is reversed and servicing continues. SCAN algorithm Sometimes called the elevator algorithm !llustration shows total head movement of /.5 cylinders But note that if requests are uniformly dense, largest density at other end of disk and those wait the longest Operating System Concepts – 10th dition 11!21 Silberschatz, Galvin and Gagne ©2018 SCAN (Cont.) Operating System Concepts – 10th dition 11!22 Silberschatz,