Andy Wang Operating Systems COP 4610 / CGS 5765

Slides:



Advertisements
Similar presentations
Chapter 6 I/O Systems.
Advertisements

Device Management Ankur Saggar Nitin Golait Jason Foos Adam Estabrook.
Input/Output Management and Disk Scheduling
Disks.
Device Management.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
04/21/2004CSCI 315 Operating Systems Design1 Disk Scheduling.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
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
Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
IT 344: Operating Systems Winter 2010 Module 13 Secondary Storage Chia-Chi Teng CTB 265.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 12: Mass-Storage Systems.
Chapter 12: Mass-Storage Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 12: Mass-Storage.
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
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.
Device Management Andy Wang Operating Systems COP 4610 / CGS 5765.
CSE 451: Operating Systems Spring 2010 Module 12.5 Secondary Storage John Zahorjan Allen Center 534.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
Chapter 10: Mass-Storage Systems
Operating System (013022) Dr. H. Iwidat
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
Sarah Diesburg Operating Systems CS 3430
Multiple Platters.
I/O System Chapter 5 Designed by .VAS.
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
OPERATING SYSTEMS CS 3502 Fall 2017
Chapter 12: Mass-Storage Structure
Secondary Storage Secondary storage typically: Characteristics:
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.
IT 344: Operating Systems Winter 2008 Module 13 Secondary Storage
Lecture 45 Syed Mansoor Sarwar
Chapter 14 Based on the slides supporting the text
Disk scheduling In multiprogramming systems several different processes may want to use the system's resources simultaneously. The disk drive needs some.
Chapter 12: Mass-Storage Systems
Secondary Storage Devices
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
CSE 451: Operating Systems Winter 2006 Module 13 Secondary Storage
Overview Continuation from Monday (File system implementation)
CSE 451: Operating Systems Autumn 2003 Lecture 12 Secondary Storage
CSE 451: Operating Systems Winter 2007 Module 13 Secondary Storage
CSE 451: Operating Systems Spring 2006 Module 13 Secondary Storage
Disks and scheduling algorithms
Persistence: hard disk drive
CSE 451: Operating Systems Secondary Storage
Persistence: I/O devices
CSE 451: Operating Systems Winter 2003 Lecture 12 Secondary Storage
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Outline Device Management Device Manager Design Buffering
CSE 451: Operating Systems Winter 2009 Module 12 Secondary Storage
CSE 451: Operating Systems Spring 2005 Module 13 Secondary Storage
Secondary Storage Management Hank Levy
CSE451 File System Introduction and Disk Drivers Autumn 2002
CSE 451: Operating Systems Autumn 2004 Secondary Storage
Device Mgmt © 2004, D. J. Foreman.
CSE 451: Operating Systems Winter 2004 Module 13 Secondary Storage
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Device Mgmt © 2004, D. J. Foreman.
Lecture 10: Magnetic Disks
CSE 451: Operating Systems Spring 2007 Module 11 Secondary Storage
Andy Wang Operating Systems COP 4610 / CGS 5765
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Presentation transcript:

Andy Wang Operating Systems COP 4610 / CGS 5765 Device Management Andy Wang Operating Systems COP 4610 / CGS 5765

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 Optimizes the performance of individual devices

Basics of I/O Devices Main 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 A network device transmits data packets

Device Controller Converts between serial bit stream and a block of bytes Performs error correction if necessary Components Device registers to communicate with the CPU Data buffer that an OS can read or write

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

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

Device Addressing 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 access the same way as normal memory, with the same set of hardware instructions

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

Ways to Access a 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 - 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

Overlapped I/O and CPU Processing Process A (infinite loop) 67% CPU 33% I/O Process B (infinite loop) 33% CPU 67% I/O SRTF CPU I/O A Time B Time B Time A

Disk as An Example Device 70-year-old storage technology Incredibly complicated

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 arm Disk heads Disk platters

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

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

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

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

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

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

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: performed to account for changes of 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 (~4 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 RPM / 60 min/sec= 120 RPS 1/120 RPS = ~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 = ~8 msec Assume 4-Kbyte blocks 4 Kbyte / 8 msec = ~500 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 Assumes 1,000-bit paddings between sectors Larger sector size  better bandwidth Wasteful if only 1 byte out of 1 Mbyte is needed Sector size Space utilization Transfer rate (data / time) 1 byte 8 bits/1008 bits (0.8%) 125 bytes/sec (1 byte / 8 msec) 4 Kbytes 4096 bytes/4221 bytes (97%) 500 Kbytes/sec (4 Kbytes / 8 msec) 1 Mbyte (~100%) 58 Mbytes/sec (peak bandwidth)

Disk Controller Few popular standards Differences IDE (integrated device electronics) ATA (advanced technology attachment interface) SCSI (small computer systems interface) SATA (serial ATA) 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 Note: SSTF is not optimal

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 0th track for the next round of scanning

First Come, First Serve Request queue: 3, 6, 1, 0, 7 Head start position: 2 7 6 5 4 Tracks 3 2 1 Time

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

Shortest Seek Distance First Request queue: 3, 6, 1, 0, 7 Head start position: 2 7 6 5 4 Tracks 3 2 1 Time

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

SCAN Request queue: 3, 6, 1, 0, 7 Head start position: 2 7 6 5 4 Tracks 3 2 1 Time

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

C-SCAN Request queue: 3, 6, 1, 0, 7 Head start position: 2 7 6 5 4 Tracks 3 2 1 Time

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

Flash Memory A form of solid-state memory similar to ROM Holds data without power supply Reads are fast Can be written once, more slowly Can be erased, but very slowly Limited number of erase cycles before degradation (800 – 100,000)

Physical Characteristics

NOR Flash Used in cellular phones and PDAs Byte-addressable Can write and erase individual bytes Can execute programs Mostly replaced by DRAM + NAND flash

NAND Flash Used in digital cameras and thumb drives Page-addressible 1 flash page ~= 1 disk block (1-4KB) Cannot run programs Erased in flash blocks Consists of 4 - 64 flash pages May not be atomic

Writing In Flash Memory If writing to empty flash page (~disk block), just write If writing to previously written location, erase it, then write While erasing a flash block May access other pages via other IO channels Number of channels limited by power (e.g., 16 channels max)

Implications of Slow Erases The use of flash translation layer (FTL) Write new version elsewhere Erase the old version later

Implications of Limited Erase Cycles Wear-leveling mechanism Spread erases uniformly across storage locations

Multi-level cells Use multiple voltage levels to represent bits

Implications of MLC Higher density lowers price/GB Need exponential number of voltage levels to for linear increase in density Maxed out quickly

Performance Characteristics Samsung SSD 970 Pro Read Latency 2 s/4KB 3500 MB/s Write Bandwidth 2300 MB/s Power Active 5.2W Idle 30 mW Cost $0.5/GB 2015 v-nand 512GB http://www.samsung.com/us/computer/memory-storage/MZ-V5P512BW http://www.samsung.com/us/business/oem-solutions/pdfs/V-NAND_technology_WP.pdf Micron JS28F256M29EWxx, Micron MT29F2G08ABAEAH4, http://search.digikey.com/scripts/dksearch/dksus.dll http://www.samsung.com/global/system/business/semiconductor/product/2007/6/11/NANDFlash/SLC_LargeBlock/8Gbit/K9F8G08U0M/ds_k9f8g08x0m_rev10.pdf Micron nor 2012 http://www.micron.com/parts/nor-flash/parallel-nor-flash/pc28f00bm29ewha?pc={9A9BFAD5-DEE0-49F7-ACE8-ED039D2582D6} Bandwidth 1MB/s Erase http://www.alibaba.com/showroom/nor-flash-price.html $0.1 for 4MB, $25/GB http://www.mt-system.ru/sites/default/files/docs/samsung/k9f1g08u0f_1.0.pdf https://www.samsung.com/semiconductor/global.semi.static/Samsung_NVMe_SSD_970_PRO_Data_Sheet_Rev.1.0.pdf

Pros/Cons of Flash Memory Small and light Uses less power than disk Read time comparable to DRAM No rotation/seek complexities No moving parts (shock resistant) Expensive (compared to disk) Erase cycle very slow (4.5ms) Limited number of erase cycles