Lecture 14 I/O Devices & Hard Disk Drives. vgetmem only from private heap.

Slides:



Advertisements
Similar presentations
CS 6560: Operating Systems Design
Advertisements

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.
Lecture 16 Raid. Device Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O.
CSCE 212 Chapter 8 Storage, Networks, and Other Peripherals Instructor: Jason D. Bakos.
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.
Disks.
Avishai Wool lecture Introduction to Systems Programming Lecture 9 Input-Output Devices.
Secondary Storage CSCI 444/544 Operating Systems Fall 2008.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Operating Systems Input/Output Devices (Ch 5: )
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
Disk and I/O Management
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Disk-based Storage Oct. 23, 2008 Topics Storage technologies and trends Locality of reference Caching in the memory hierarchy lecture-17.ppt “The.
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
Disk Memory Topics Disk Memory Structure Disk Capacity class10.ppt.
Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
Topic: Disks – file system devices. Rotational Media Sector Track Cylinder Head Platter Arm Access time = seek time + rotational delay + transfer time.
1 Lecture 8: Secondary-Storage Structure 2 Disk Architecture Cylinder Track SectorDisk head rpm.
IT 344: Operating Systems Winter 2010 Module 13 Secondary Storage Chia-Chi Teng CTB 265.
Disks Chapter 5 Thursday, April 5, Today’s Schedule Input/Output – Disks (Chapter 5.4)  Magnetic vs. Optical Disks  RAID levels and functions.
CS 3204 Operating Systems Godmar Back Lecture 22.
15-410, S’ Disks Mar. 24, 2004 Dave Eckhardt & Bruce Maggs Brian Railing & Steve Muckle Contributions from Eno Thereska “How Stuff Works”
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Disks and Disk Scheduling Steve Muckle Monday, March 31st Spring 2003.
I/O Devices. Characteristics of I/O Devices  Block Devices  Information are stored and accessed in fixed-size blocks  Addressable, can have sequential.
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.
Device Management Mark Stanovich Operating Systems COP 4610.
CS399 New Beginnings Jonathan Walpole. Disk Technology & Secondary Storage Management.
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.
10/15: Lecture Topics Input/Output –Types of I/O Devices –How devices communicate with the rest of the system communicating with the processor communicating.
LECTURE 13 I/O. I/O CANNOT BE IGNORED Assume a program requires 100 seconds, 90 seconds for main memory, 10 seconds for I/O. Assume main memory access.
1 Components of the Virtual Memory System  Arrows indicate what happens on a lw virtual address data physical address TLB page table memory cache disk.
Lecture 17 Raid. Device Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O.
File organization Secondary Storage Devices Lec#7 Presenter: Dr Emad Nabil.
CSE 451: Operating Systems Spring 2010 Module 12.5 Secondary Storage John Zahorjan Allen Center 534.
I/O Devices.
Sarah Diesburg Operating Systems CS 3430
Multiple Platters.
Disks and RAID.
Database Management Systems (CS 564)
I/O System Chapter 5 Designed by .VAS.
OPERATING SYSTEMS CS 3502 Fall 2017
Secondary Storage Secondary storage typically: Characteristics:
Lecture 45 Syed Mansoor Sarwar
CSE 153 Design of Operating Systems Winter 2018
Lecture 13 I/O.
CSE 451: Operating Systems Winter 2006 Module 13 Secondary Storage
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
Persistence: hard disk drive
CSE 451: Operating Systems Secondary Storage
Persistence: I/O devices
CSE 451: Operating Systems Winter 2003 Lecture 12 Secondary Storage
CSE 451: Operating Systems Spring 2005 Module 13 Secondary Storage
Disks and Disk Scheduling
CSE451 File System Introduction and Disk Drivers Autumn 2002
CSE 451: Operating Systems Autumn 2004 Secondary Storage
CSE 451: Operating Systems Winter 2004 Module 13 Secondary Storage
Lecture 10: Magnetic Disks
Disks Magnetic (hard) Disk arrays are used for reliable storage (RAID)
Andy Wang Operating Systems COP 4610 / CGS 5765
Introduction to Operating Systems
Presentation transcript:

Lecture 14 I/O Devices & Hard Disk Drives

vgetmem only from private heap

Midterm statistics Number of people taking the exam: 76 average: 72 medium: 69/70 below 60: : : : : 8 above 100: 3

We need I/O devices

The Canonical Device Micro-controller (CPU) Memory (DRAM or SRAM or both) Other Hardware-specific Chips StatusCommandData Device Registers Hidden Internals The interface for OS to interact

The Canonical Protocol While (STATUS == BUSY)// 1 ; // wait until device is not busy Write data to DATA register// 2 Write command to COMMAND register// 3 (To start the device & executes the command) While (STATUS == BUSY)// 4 ; // wait until device is done with your request

A trace CPU: Disk: AB CA

Using interrupts to avoid spinning CPU: Disk: A A AB CA 1 3,4 2 BB

Interrupts vs. Polling Discussion: could interrupt be worse under some cases? Techniques: Hybrid approach Interrupt coalescing

What else can we optimize? CPU: Disk: A A AB CA 1 3,4 2 BB

Programmed I/O vs. Direct Memory Access PIO (Programmed I/O): CPU directly tells device what data is DMA (Direct Memory Access): CPU leaves data in memory Device reads it directly

Using DMA CPU: Disk: A B CA 1 3,4 BB

How does OS access registers? Special instructions each device has a port in/out instructions (x86) communicate with device Memory-Mapped I/O H/W maps registers into address space loads/stores sent to device Doesn’t matter much (both are used).

Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O

Variety is a Challenge Problem: many, many devices each has its own protocol How can we avoid writing a slightly different OS for each H/W combination? Encapsulation! Write driver for each device. Drivers are 70% of Linux source code.

The File System Stack

Hard Disk Basic Interface Disk has a sector-addressable address space (so a disk is like an array of sectors). Sectors are typically 512 bytes or 4096 bytes. By the end of 2007, Samsung and Toshiba began shipments of 1.8-inch hard disk drives with 4096 byte sectors. In 2010, the International Disk Drive Equipment and Materials Association (IDEMA) completed the Advanced Format standard for 4096 sector drives, setting the date for the transition from 512 to 4096 byte sectors as January 2011 for all manufacturers, and Advanced Format drives soon became prevalent. [wiki] Main operations: reads + writes to sectors.

Disk Internals Platter: covered with a magnetic film. Surface: each platter has two surfaces Spindle: many platters may be bound to the spindle. Track: each surface is divided into rings, each track is further divided into numbers sectors Cylinder: a stack of tracks across platters Heads on a moving arm can read from each surface.

Three Tracks Plus A Head

Seek, Rotate, Transfer Must accelerate, coast, decelerate, settle Seeks often take several milliseconds! Settling alone can take ms. Entire seek often takes ms.

Seek, Rotate, Transfer Depends on rotations per minute (RPM) RPM is common, RPM is high end. 1 / 7200 RPM = 1 minute / 7200 rotations = 1 second / 120 rotations = 8.3 ms / rotation so it may take 4.2 ms on avg to rotate to target (0.5 * 8.3 ms)

Seek, Rotate, Transfer Pretty fast — depends on RPM and sector density MB/s is typical. 1s / 100 MB = 10 ms / MB = 4.9 us / sector (assuming 512-byte sector)

Workload So… seeks are slow rotations are slow transfers are fast What kind of workload is fastest for disks? Sequential: access sectors in order (transfer dominated) Random: access sectors arbitrarily (seek+rotation dominated)

Disk Spec Sequential workload: what is throughput for each? Close to max transfer rate if workload large enough Random workload: what is throughput for each? Assume 16-KB reads, 2.5 MB/s and 1.2MB/s

Track Skew

Zones

Other Improvements Track Skew Zones Cache Drives may cache both reads and writes.

Schedulers Given a stream of requests, in what order should they be served? Try to follow SJF (shortest job first) SSTF: Shortest Seek Time First Difficult for OS, starvation Elevator (a.k.a. SCAN or C-SCAN) Still ignore rotation time

SPTF: Shortest Positioning Time First

Other Issues Both OS and disk do some scheduling I/O merging Work Conservation

Only One Disk? Sometimes we want many disks — why? capacity performance reliability Challenge: most file systems work on only one disk.

Solution 1: JBOD JBOD: Just a Bunch Of Disks Application is smart, stores different files on different file systems. FS Application

Solution 2: RAID RAID: Redundant Array of Inexpensive Disks Transparent and deployable Capacity and performance Reliability? FS Fake Disk Application

Why Inexpensive Disks? Economies of scale! Cheap disks are popular. You can often get many commodity H/W components for the same price as a few expensive components. Strategy: write S/W to build high-quality logical devices from many cheap devices. Alternative to RAID: buy an expensive, high-end disk.

General Strategy Build fast, large disk from smaller ones. Add even more disks for reliability. Disk RAID Disk 0 100

Mapping How should we map logical to physical addresses? How is this problem similar to virtual memory? Dynamic mapping: use data structure (hash table, tree) paging Static mapping: use math RAID

Redundancy Redundancy: how many copies? System engineers are always trying to increase or decrease redundancy. Increase: replication (e.g., RAID) Decrease: deduplication (e.g., code sharing) One strategy: reduce redundancy as much is possible. Then add back just the right amount.