Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.

Slides:



Advertisements
Similar presentations
I/O Management and Disk Scheduling
Advertisements

Chapter 6 I/O Systems.
I/O Management and Disk Scheduling
I/O Management and Disk Scheduling
Device Management Ankur Saggar Nitin Golait Jason Foos Adam Estabrook.
Disk Scheduling Based on the slides supporting the text 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Disks and RAID.
OPERATING SYSTEMS CS3530 Summer 2014 OPERATING SYSTEMS CS3530 Summer 2014 Input/Output System Chapter 9.
Input/Output Management and Disk Scheduling
04/18/2007CSCI 315 Operating Systems Design1 Mass Storage Structure Notice: The slides for this lecture have been largely based on those accompanying the.
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
Based on the slides supporting the text
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
Slide 5-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 5.
Disks.
Device Management.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
04/21/2004CSCI 315 Operating Systems Design1 Disk Scheduling.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
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
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Disk & disk scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13+14: I/O Systems and Mass- Storage Structure I/O Hardware Application I/O.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable Used to communicate with the user Printers Video display terminals.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
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.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable –Used to communicate with the user –Printers –Video display.
O VERVIEW OF M ASS S TORAGE S TRUCTURE Magnetic disks provide bulk of secondary storage of modern computers Drives rotate at 60 to 250 times per second.
15-410, S’ Disks Mar. 24, 2004 Dave Eckhardt & Bruce Maggs Brian Railing & Steve Muckle Contributions from Eno Thereska “How Stuff Works”
Lecture 3 Page 1 CS 111 Online Disk Drives An especially important and complex form of I/O device Still the primary method of providing stable storage.
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
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.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 13 Mass-Storage Systems Slide 1 Chapter 13 Mass-Storage Systems.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Chapter 14: Mass-Storage Systems Disk Structure. Disk Scheduling. RAID.
Device Management Mark Stanovich Operating Systems COP 4610.
Chapter 9 I/O System. 2 Input/Output System I/O Major objectives are: Take an application I/O request and send it to the physical device. Then, take whatever.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Presentation-4 Group-A1 Professor Mohamed Khalil Anita Kanuganti Hemanth Rao.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Part IV I/O System Chapter 12: Mass Storage Structure.
Device Management Andy Wang Operating Systems COP 4610 / CGS 5765.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Chapter 10: Mass-Storage Systems
Operating System (013022) Dr. H. Iwidat
Sarah Diesburg Operating Systems CS 3430
Multiple Platters.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Operating System I/O System Monday, August 11, 2008.
Disk Scheduling Algorithms
Mass-Storage Structure
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Andy Wang Operating Systems COP 4610 / CGS 5765
Persistence: hard disk drive
Persistence: I/O devices
Outline Device Management Device Manager Design Buffering
Disks and Disk Scheduling
Andy Wang Operating Systems COP 4610 / CGS 5765
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Presentation transcript:

Device Management

So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that manages hardware devices  Provides a uniform interface to access devices with different physical characteristics  Optimize the performance of individual devices

I/O hardware I/O device hardware  Many varieties Device controller Conversion a block of bytes and I/O operations Performs error correction if necessary Expose hardware registers to control the device Typically have four registers: Data-in register to be read to get input Data-out register to be written to send output Status register (allows the status of the device to be checked) Control register (controls the command the device performs)

Device Addressing How the CPU addresses the device registers? Two approaches  Dedicated range of device addresses in the physical memory Requires special hardware instructions associated with individual devices  Memory-mapped I/O: makes no distinction between device addresses and memory addresses Devices can be accessed the same way as normal memory, with the same set of hardware instructions

Device Addressing Illustrated Primary memory Device 1 Device 2 Memory addresses Memory-mapped I/Os Primary memory Device addresses Separate device addresses

Ways to Access a Device How to input and output data to and from an I/O device? Polling: a CPU repeatedly checks the status of a device for exchanging data + Simple - Busy-waiting

Ways to Access a Device Interrupt-driven I/Os: A device controller notifies the corresponding device driver when the device is available + More efficient use of CPU cycles - Data copying and movements - Slow for character devices (i.e., one interrupt per keyboard input)

Ways to Access a Device Direct memory access (DMA): uses an additional controller to perform data movements + CPU is not involved in copying data - I/O device is much more complicated (need to have the ability to access memory). - A process cannot access in-transit data

Ways to Access a Device Double buffering: uses two buffers. While one is being used, the other is being filled.  Analogy: pipelining  Extensively used for graphics and animation So a viewer does not see the line-by-line scanning

Device Driver An OS component that is responsible for hiding the complexity of an I/O device So that the OS can access various devices in a uniform manner

Types of IO devices Two categories  A block device stores information in fixed-size blocks, each one with its own address e.g., disks  A character device delivers or accepts a stream of characters, and individual characters are not addressable e.g., keyboards, printers, network cards Device driver provides interface for these two types of devices  Other OS components see block devices and character devices, but not the details of the devices.  How to effectively utilize the device is the responsibility of the device driver

Device Driver Illustrated User applications Various OS components Device drivers Device controllers I/O devices User level OS level Hardware level

Disk as An Example Device 30-year-old storage technology Incredibly complicated A modern drive  250,000 lines of micro code

Disk Characteristics Disk platters: coated with magnetic materials for recording Disk platters

Disk Characteristics Disk arm: moves a comb of disk heads  Only one disk head is active for reading/writing Disk platters Disk arm Disk heads

Hard Disk Trivia… Aerodynamically designed to fly  As close to the surface as possible  No room for air molecules Therefore, hard drives are filled with special inert gas If head touches the surface  Head crash  Scrapes off magnetic information

Disk Characteristics Each disk platter is divided into concentric tracks Disk platters Disk arm Disk heads Track

Disk Characteristics A track is further divided into sectors. A sector is the smallest unit of disk storage Disk platters Disk arm Disk heads Track Sector

Disk Characteristics A cylinder consists of all tracks with a given disk arm position Disk platters Disk arm Disk heads Track Sector Cylinder

Disk Characteristics Cylinders are further divided into zones Disk platters Disk arm Disk heads Track Sector Cylinder Zones

Disk Characteristics Zone-bit recording: zones near the edge of a disk store more information (higher bandwidth) Disk platters Disk arm Disk heads Track Sector Cylinder Zones

More About Hard Drives Than You Ever Want to Know Track skew: starting position of each track is slightly skewed  Minimize rotational delay when sequentially transferring bytes across tracks Thermo-calibrations: periodically performed to account for changes of disk radius due to temperature changes Typically 100 to 1,000 bits are inserted between sectors to account for minor inaccuracies

Disk Access Time Seek time: the time to position disk heads (~8 msec on average) Rotational latency: the time to rotate the target sector to underneath the head  Assume 7,200 rotations per minute (RPM)  7,200 / 60 = 120 rotations per second  1/120 = ~8 msec per rotation  Average rotational delay is ~4 msec

Disk Access Time Transfer time: the time to transfer bytes  Assumptions: 58 Mbytes/sec 4-Kbyte disk blocks  Time to transfer a block takes 0.07 msec Disk access time  Seek time + rotational delay + transfer time

Disk Performance Metrics Latency  Seek time + rotational delay Bandwidth  Bytes transferred / disk access time

Examples of Disk Access Times If disk blocks are randomly accessed  Average disk access time = ~12 msec  Assume 4-Kbyte blocks  4 Kbyte / 12 msec = ~340 Kbyte/sec If disk blocks of the same cylinder are randomly accessed without disk seeks  Average disk access time = ~4 msec  4 Kbyte / 4 msec = ~ 1 Mbyte/sec

Examples of Disk Access Times If disk blocks are accessed sequentially  Without seeks and rotational delays  Bandwidth: 58 Mbytes/sec Key to good disk performance  Minimize seek time and rotational latency

Disk Tradeoffs Larger sector size  better bandwidth Wasteful if only 1 byte out of 1 Mbyte is needed Sector sizeSpace utilizationTransfer rate 1 byte8 bits/1008 bits (0.8%)80 bytes/sec (1 byte / 12 msec) 4 Kbytes4096 bytes/4221 bytes (97%)340 Kbytes/sec (4 Kbytes / 12 msec) 1 Mbyte(~100%)58 Mbytes/sec (peak bandwidth)

Disk Controller Few popular standards  IDE (integrated device electronics)  ATA (AT attachment interface)  SCSI (small computer systems interface) Differences  Performance  Parallelism

Disk Device Driver Major goal: reduce seek time for disk accesses  Schedule disk request to minimize disk arm movements

Disk Arm Scheduling Policies First come, first serve (FCFS): requests are served in the order of arrival + Fair among requesters - Poor for accesses to random disk blocks Shortest seek time first (SSTF): picks the request that is closest to the current disk arm position + Good at reducing seeks - May result in starvation

Disk Arm Scheduling Policies SCAN: takes the closest request in the direction of travel (an example of elevator algorithm) + no starvation - a new request can wait for almost two full scans of the disk

Disk Arm Scheduling Policies Circular SCAN (C-SCAN): disk arm always serves requests by scanning in one direction.  Once the arm finishes scanning for one direction  Returns to the 0 th track for the next round of scanning

First Come, First Serve Request queue: 3, 6, 1, 0, 7 Head start position: 2 Total seek distance: = 17 Tracks Time

Shortest Seek Distance First Request queue: 3, 6, 1, 0, 7 Head start position: 2 Total seek distance: = 10 Tracks Time

SCAN Request queue: 3, 6, 1, 0, 7 Head start position: 2 Total seek distance: = 9 Time Tracks

C-SCAN Request queue: 3, 6, 1, 0, 7 Head start position: 2 Total seek distance: = 13 Time Tracks

Look and C-Look Similar to SCAN and C-SCAN  the arm goes only as far as the final request in each direction, then turns around Look for a request before continuing to move in a given direction.