Disks and scheduling algorithms

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne Operating System Concepts Disk Scheduling Disk IO requests are for blocks, by number Block requests come in an.
Advertisements

Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
I/O Management and Disk Scheduling
Faculty of Information Technology Department of Computer Science Computer Organization Chapter 7 External Memory Mohammad Sharaf.
CS 6560: Operating Systems Design
Disk Scheduling Based on the slides supporting the text 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
Other Disk Details. 2 Disk Formatting After manufacturing disk has no information –Is stack of platters coated with magnetizable metal oxide Before use,
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
Based on the slides supporting the text
Disks.
1 Disk Scheduling Chapter 14 Based on the slides supporting the text.
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Avishai Wool lecture Introduction to Systems Programming Lecture 9 Input-Output Devices.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
04/21/2004CSCI 315 Operating Systems Design1 Disk Scheduling.
Operating Systems COMP 4850/CISG 5550 Disks, Part II Dr. James Money.
12.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 12: Mass-Storage Systems.
Disk and I/O Management
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
1 Recitation 8 Disk & File System. 2 Disk Scheduling Disks are at least four orders of magnitude slower than main memory –The performance of disk I/O.
Mass storage Structure Unit 5 (Chapter 14). Disk Structures Magnetic disks are faster than tapes. Disk drives are addressed as large one- dimensional.
Chapter 5: I/O Systems. Chapter 5 2 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Input/Output Principles of I/O hardware.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
1 Lecture 8: Secondary-Storage Structure 2 Disk Architecture Cylinder Track SectorDisk head rpm.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Page 110/12/2015 CSE 30341: Operating Systems Principles Network-Attached Storage  Network-attached storage (NAS) is storage made available over a network.
1Fall 2008, Chapter 12 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
CS 6502 Operating Systems Dr. J.. Garrido Device Management (Lecture 7b) CS5002 Operating Systems Dr. Jose M. Garrido.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 14: Mass-Storage Systems Disk Structure Disk Scheduling Disk Management Swap-Space.
1.  Disk Structure Disk Structure  Disk Scheduling Disk Scheduling  FCFS FCFS  SSTF SSTF  SCAN SCAN  C-SCAN C-SCAN  C-LOOK C-LOOK  Selecting a.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 13 Mass-Storage Systems Slide 1 Chapter 13 Mass-Storage Systems.
Chapter 14: Mass-Storage Systems Disk Structure. Disk Scheduling. RAID.
Disk Average Seek Time. Multi-platter Disk platter Disk read/write arm read/write head.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
M ASS S TORAGE S TRUCTURES Lecture: Operating System Concepts Lecturer: Pooja Sharma Computer Science Department, Punjabi University, Patiala.
Part IV I/O System Chapter 12: Mass Storage Structure.
Magnetic Disks Have cylinders, sectors platters, tracks, heads virtual and real disk blocks (x cylinders, y heads, z sectors per track) Relatively slow,
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems DISK I/0.
Chapter 10: Mass-Storage Systems
Operating System (013022) Dr. H. Iwidat
Multiple Platters.
Disks and RAID.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
OPERATING SYSTEMS CS 3502 Fall 2017
CS 554: Advanced Database System Notes 02: Hardware
Chapter 12: Mass-Storage Structure
Operating System I/O System Monday, August 11, 2008.
Disk Scheduling Algorithms
Mass-Storage Structure
DISK SCHEDULING FCFS SSTF SCAN/ELEVATOR C-SCAN C-LOOK.
Chapter 14 Based on the slides supporting the text
Disks.
Chapter 12: Mass-Storage Systems
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Overview Continuation from Monday (File system implementation)
Jonathan Walpole Computer Science Portland State University
Secondary Storage Management Brian Bershad
Persistence: hard disk drive
Mass-Storage Systems.
Secondary Storage Management Hank Levy
CS333 Intro to Operating Systems
CSE451 File System Introduction and Disk Drivers Autumn 2002
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Disks Magnetic (hard) Disk arrays are used for reliable storage (RAID)
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Presentation transcript:

Disks and scheduling algorithms

Disk drive structure Data stored on surfaces Data in concentric tracks Up to two surfaces per platter One or more platters per disk Data in concentric tracks Tracks broken into sectors 256B-1KB per sector Cylinder: corresponding tracks on all surfaces Data read and written by heads Actuator moves heads Heads move in unison head sector platter track cylinder surfaces spindle actuator CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Disk “zones” Outside tracks are longer than inside tracks Two options Bits are “bigger” More bits (transfer faster) Modern hard drives use second option More data on outer tracks Disk divided into “zones” Constant sectors per track in each zone 8–20 (or more) zones on a disk CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Disk “addressing” Millions of sectors on the disk must be labeled Two possibilities Cylinder/track/sector Sequential numbering (logical block addressing, LBA) Modern drives use LBA Disks map sequential numbers into specific location (like a page table, but on disk) Mapping may be modified by the disk Remap bad sectors Optimize performance Hide the exact geometry, making life simpler for the OS CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Building a better “disk” Problem: CPU performance has been increasing exponentially, but disk performance hasn’t Disks are limited by mechanics Problem: disks aren’t all that reliable Solution: distribute data across disks, and use some of the space to improve reliability Data transferred in parallel Data stored across drives (striping) Parity on an “extra” drive for reliability CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

RAIDs, RAIDs, and more RAIDs Stripe stripe stripe RAID 0 (Redudant Array of Inexpensive Disks RAID 1 (Mirrored copies) RAID 4 (Striped with parity: any disk failure can be masked, but bottleneck for parity disk) RAID 5 (Parity rotates through disks: how do you update blocks?) CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Optical media recording CD-ROM, DVDs have data in a spiral Cf. with hard drives and floppies, which have concentric circles of data One continuous track: just like vinyl records! (ask your grandparents what they are) Pits & lands “simulated” with heat-sensitive material on CD-Rs and CD-RWs Separated into tracks/chapters/sessions TOC gives locations CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Structure of a disk sector Preamble Data ECC Preamble contains information about the sector Sector number & location information Data is usually 256, 512, or 1024 bytes ECC (Error Correcting Code) is used to detect & correct minor errors in the data CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Sector layout on disk Sectors numbered sequentially on each track Numbering starts in different place on each track: sector skew Allows time for switching head from track to track All done to minimize delay in sequential transfers CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Sector interleaving On older systems, the CPU was slow => time elapsed between reading consecutive sectors Solution: leave space between consecutively numbered sectors This isn’t done much these days… 7 7 5 6 1 3 4 2 3 5 2 6 1 7 6 4 3 2 5 4 1 No interleaving Skipping 1 sector Skipping 2 sectors CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

What’s in a disk request? Time required to read or write a disk block determined by 3 factors Seek time Rotational delay Average delay = 1/2 rotation time Example: rotate in 10ms, average rotation delay = 5ms Actual transfer time Transfer time = time to rotate over sector Example: rotate in 10ms, 200 sectors/track => 10/200 ms = 0.05ms transfer time per sector Seek time dominates, with rotation time close Error checking is done by controllers CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Disk request scheduling Goal: use disk hardware efficiently Bandwidth as high as possible Disk transferring as often as possible (and not seeking) We want to Minimize disk seek time (moving from track to track) Minimize rotational latency (waiting for disk to rotate the desired sector under the read/write head) Calculate disk bandwidth by Total bytes transferred / time to service request Seek time & rotational latency are overhead (no data is transferred), and reduce disk bandwidth Minimize seek time & rotational latency by Using algorithms to find a good sequence for servicing requests Placing blocks of a given file “near” each other CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Disk scheduling algorithms Schedule disk requests to minimize disk seek time Seek time increases as distance increases (though not linearly) Minimize seek distance -> minimize seek time Disk seek algorithm examples assume a request queue & head position (disk has 200 cylinders) Queue = 100, 175, 51, 133, 8, 140, 73, 77 Head position = 63 Outside edge Inside edge 8 51 73 100 133 175 77 140 read/write head position disk requests (cylinder in which block resides) CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

First-Come-First Served (FCFS) Requests serviced in the order in which they arrived Easy to implement! May involve lots of unnecessary seek distance Seek order = 100, 175, 51, 133, 8, 140, 73, 77 Seek distance = (100-63) + (175-100) + (175-51) + (133-51) + (133-8) + (140-8) + (140-73) + (77-73) = 646 cylinders read/write head start 100 175 51 133 8 140 73 77 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Shortest Seek Time First (SSTF) Service the request with the shortest seek time from the current head position Form of SJF scheduling May starve some requests Seek order = 73, 77, 51, 8, 100, 133, 140, 175 Seek distance = 10 + 4 + 26 + 43 + 92 + 33 + 7 + 35 = 250 cylinders read/write head start 73 77 51 8 100 133 140 175 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

SCAN (elevator algorithm) Disk arm starts at one end of the disk and moves towards the other end, servicing requests as it goes Reverses direction when it gets to end of the disk Also known as elevator algorithm Seek order = 51, 8, 0 , 73, 77, 100, 133, 140, 175 Seek distance = 12 + 43 + 8 + 73 + 4 + 23 + 33 + 7 + 35 = 238 cyls read/write head start 51 8 73 77 100 133 140 175 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

C-SCAN Identical to SCAN, except head returns to cylinder 0 when it reaches the end of the disk Treats cylinder list as a circular list that wraps around the disk Waiting time is more uniform for cylinders near the edge of the disk Seek order = 73, 77, 100, 133, 140, 175, 199, 0, 8, 51 Distance = 10 + 4 + 23 + 33 + 7 + 35 + 24 + 199 + 8 + 43 = 386 cyls read/write head start 73 77 100 133 140 175 8 51 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

C-LOOK Identical to C-SCAN, except head only travels as far as the last request in each direction Saves seek time from last sector to end of disk Seek order = 73, 77, 100, 133, 140, 175, 8, 51 Distance = 10 + 4 + 23 + 33 + 7 + 35 + 167 + 43 = 322 cylinders read/write head start 73 77 100 133 140 175 8 51 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

How to pick a disk scheduling algorithm SSTF is easy to implement and works OK if there aren’t too many disk requests in the queue SCAN-type algorithms perform better for systems under heavy load More fair than SSTF Use LOOK rather than SCAN algorithms to save time Long seeks aren’t too expensive, so choose C-LOOK over LOOK to make response time more even Disk request scheduling interacts with algorithms for allocating blocks to files Make scheduling algorithm modular: allow it to be changed without changing the file system Use SSTF for lightly loaded systems Use C-LOOK for heavily loaded systems CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

When good disks go bad… Disks have defects In 3M+ sectors, this isn’t surprising! ECC helps with errors, but sometimes this isn’t enough Disks keep spare sectors (normally unused) and remap bad sectors into these spares If there’s time, the whole track could be reordered… CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5