I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

Similar documents
I/O Systems and Storage Devices

Module 13: Secondary-Storage Structure

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Disk Scheduling. Based on the slides supporting the text

Disk Scheduling. Chapter 14 Based on the slides supporting the text and B.Ramamurthy s slides from Spring 2001

Chapter 10: Mass-Storage Systems

Chapter 14: Mass-Storage Systems. Disk Structure

CSE325 Principles of Operating Systems. Mass-Storage Systems. David P. Duggan. April 19, 2011

CS420: Operating Systems. Mass Storage Structure

Chapter 12: Secondary-Storage Structure. Operating System Concepts 8 th Edition,

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

V. Mass Storage Systems

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

Chapter 13: Mass-Storage Systems. Disk Scheduling. Disk Scheduling (Cont.) Disk Structure FCFS. Moving-Head Disk Mechanism

Chapter 13: Mass-Storage Systems. Disk Structure

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Mass-Storage Structure

Overview of Mass Storage Structure

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS3600 SYSTEMS AND NETWORKS

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

EIDE, ATA, SATA, USB,

OPERATING SYSTEMS CS3502 Spring Input/Output System Chapter 9

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

Free Space Management

Chapter 10: Mass-Storage Systems

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

Lecture 9. I/O Management and Disk Scheduling Algorithms

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

Basic Memory Management

Hard Disk Drives (HDDs)

Chapter 12: Mass-Storage

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

Chapter 11 I/O Management and Disk Scheduling

I/O Management and Disk Scheduling. Chapter 11

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

Disc Allocation and Disc Arm Scheduling?

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

CSE 380 Computer Operating Systems

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Principles of Operating Systems CS 446/646

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

More on Synchronization and Deadlock

Chapter 12: Mass-Storage Systems. Operating System Concepts 8 th Edition,

Operating Systems 2010/2011

CS370 Operating Systems

CHAPTER 12 AND 13 - MASS-STORAGE STRUCTURE & I/O- SYSTEMS

Main Points of the Computer Organization and System Software Module

Operating Systems, Fall

Principles of Operating Systems CS 446/646

Chapter 10: Mass-Storage Systems

Lecture 21 Disk Devices and Timers

CSC Operating Systems Spring Lecture - XIX Storage and I/O - II. Tevfik Koşar. Louisiana State University.

RAID Structure. RAID Levels. RAID (cont) RAID (0 + 1) and (1 + 0) Tevfik Koşar. Hierarchical Storage Management (HSM)

Mass-Storage Structure

Chapter 11. I/O Management and Disk Scheduling

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

CHAPTER 12: MASS-STORAGE SYSTEMS (A) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Module 13: Secondary-Storage

Silberschatz, et al. Topics based on Chapter 13

CSCI-GA Operating Systems. I/O : Disk Scheduling and RAID. Hubertus Franke

Chapter 14: Mass-Storage Systems

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Fall 2017

Outline. Operating Systems: Devices and I/O p. 1/18

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

QUESTION BANK UNIT I

Chapter 10: Mass-Storage Systems. Operating System Concepts 9 th Edition

CS370 Operating Systems

CSE380 - Operating Systems. Communicating with Devices

Mass-Storage Systems. Mass-Storage Systems. Disk Attachment. Disk Attachment

CIS Operating Systems I/O Systems & Secondary Storage. Professor Qiang Zeng Spring 2018

UNIT-7. Overview of Mass Storage Structure

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Processes & Threads. Recap of the Last Class. Microkernel System Architecture. Layered Structure

I/O 1. Devices and I/O. key concepts device registers, device drivers, program-controlled I/O, DMA, polling, disk drives, disk head scheduling

I/O & Storage. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

Today: Secondary Storage! Typical Disk Parameters!

Lecture 13 Input/Output (I/O) Systems (chapter 13)

UNIT 4 Device Management

Lecture 15: I/O Devices & Drivers

Chapter 7: Mass-storage structure & I/O systems. Operating System Concepts 8 th Edition,

Transcription:

I/O Device Controllers I/O Systems CS 256/456 Dept. of Computer Science, University of Rochester 10/20/2010 CSC 2/456 1 I/O devices have both mechanical component & electronic component The electronic component is the device controller It contains control logic, command registers, status registers, and on-board buffer space 10/20/2010 CSC 2/456 2 I/O Ports & Memory-Mapped I/O Direct Memory Access (DMA) I/O methods: Separate I/O and memory space; special I/O commands (IN/OUT) Memory-mapped I/O Issues with them: Convenience/efficiency when using high-level language; Protection mechanisms; Special data access schemes: TEST Data caching 10/20/2010 CSC 2/456 3 Are the addresses CPU sends to the DMA controller virtual or physical addresses? Can the disk controller directly read data into the main memory (bypassing the controller buffer)? 10/20/2010 CSC 2/456 4 CSC 256/456 Fall 2010 1

How is I/O accomplished? Polling-based CPU spins and polls the I/O until it completes Periodic polling Continuous polling consumes too much CPU Instead, we poll periodically - saving CPU overhead, may not react immediately to hardware events Interrupt Handlers 1. Save registers of the old process 2. Set up context for interrupt service procedure (switch from the user space to kernel space: MMU, stack, ) 3. Run service procedure; when safe, re-enable interrupts 4. Run scheduler to choose the new process to run next 5. Set up context (MMU, registers) for process to run next 6. Start running the new process Interrupt-driven CPU initiates I/O and then does something else; gets notified when the I/O is done (interrupts) How much cost is it? Is it a big deal? For Gigabit Ethernet, each packet arrives once every 12us. 10/20/2010 CSC 2/456 5 10/20/2010 CSC 2/456 6 Interrupt Vectors I/O Software Layers Intel Pentium processor event-vector table 0: divide by zero 6: invalid opcode 11: segment not present 12: stack fault 14: page fault 31: non-maskable 32-255: maskable interrupts 10/20/2010 CSC 2/456 7 Device-dependent OS I/O software; directly interacts with controller hardware Interface to upper-layer OS code is standardized 10/20/2010 CSC 2/456 8 CSC 256/456 Fall 2010 2

Software in the machine Device Driver Reliability Device driver is the device-specific part of the kernelspace I/O software; It also includes interrupt handlers Device drivers must run in kernel mode The crash of a device driver typically brings down the whole system Device drivers are probably the buggiest part of the OS How to make the system more reliable by isolating the faults of device drivers? Run most of the device driver code at user level Restrict and limit device driver operations in the kernel High-level I/O Software Device independence reuse software as much as possible across different types of devices Buffering data coming off a device is stored in intermediate buffer access speed/granularity matching with I/O devices caching speculative I/O 10/20/2010 CSC 2/456 9 10/20/2010 CSC 2/456 10 I/O System Layers Application Program High-level OS software Device driver Device driver Software Program to manage device controller System software (part of OS) Disk Drive Mechanical Parts Track Cylinder (set of tracks) Device controller Contains control logic, command registers, status registers, and onboard buffer space Firmware/hardware Device Controller Device 10/20/2010 CSC 2/456 11 Multi-surface Disk Disk Surface Cylinders 10/20/2010 CSC 2/456 12 CSC 256/456 Fall 2010 3

Seek time (millisecond) Transfer throughput (MB/sec) Disk Structure Disk Performance Characteristics Disk drives are addressed as large 1- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. Sector 0 is the first 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. Cylinder (set of tracks) 10/20/2010 CSC 2/456 13 A disk operation has three major components Seek moving the heads to the cylinder containing the desired sector Rotation rotating the desired sector to the disk head Transfer sequentially moving data to or from disk 0 Seek time Seek (millisecond) distance 10/20/2010 CSC 2/456 14 12 10 8 6 4 2 60 40 20 A Seagate SCSI drive An IBM SCSI drive 0 Starting transfer address Read throughput (MB/sec) Disk Scheduling FCFS (First-Come-First-Serve) Disk scheduling choose from outstanding disk requests when the disk is ready for a new request can be done in both disk controller and the operating system Disk scheduling non-preemptible Goals of disk scheduling overall efficiency small resource consumption for completing disk I/O workload fairness prevent starvation 10/20/2010 CSC 2/456 15 Illustration shows the total head movement is 640. Starvation? 10/20/2010 CSC 2/456 16 CSC 256/456 Fall 2010 4

SSTF (Shortest-Seek-Time-First) Selects the request with the minimum seek time from the current head position. SSTF scheduling is a form of SJF scheduling. Illustration shows the total head movement is 236. SCAN The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end, where the head movement is reversed and servicing continues. Sometimes called the elevator algorithm. Illustration shows the total head movement is 208. Starvation? Starvation? 10/20/2010 CSC 2/456 17 10/20/2010 CSC 2/456 18 C-SCAN (Circular-SCAN) Provides a more uniform wait time than SCAN. The head moves from one end of the disk to the other. servicing requests as it goes. When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip. C-LOOK Variation of C-SCAN Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk. Starvation? 10/20/2010 CSC 2/456 19 10/20/2010 CSC 2/456 20 CSC 256/456 Fall 2010 5

Deadline Scheduling in Linux A regular elevator-style scheduler similar to C-LOOK Additionally, all I/O requests are put into a FIFO queue with an expiration time (e.g., 500ms) When the head request in the FIFO queue expires, it will be executed next (even if it is not next in line according to C-LOOK). A mix of performance and fairness. Concurrent I/O Consider two request handlers in a Web server each accesses a different stream of sequential data (a file) on disk; each reads a chunk (the buffer size) at a time; does a little CPU processing; and reads the next chunk What happens? A thread/process A thread/process A thread/process Timeline Disk I/O CPU or waiting for I/O 10/20/2010 CSC 2/456 21 10/20/2010 CSC 2/456 22 Aggressive prefetching How to Deal with It? Anticipatory scheduling [Iyer & Druschel, SOSP 2001] at the completion of an I/O request, the disk scheduler will wait a bit (despite the fact that there is other work to do), in anticipation that a new request with strong locality will be issued; schedule another request if no such new request appears before timeout included in Linux 2.6 Exploiting Concurrency RAID: Redundant Arrays of Independent Disks RAID 0: data striping at block level, no redundancy RAID 1: mirrored disks (100% overhead) RAID 2: bit-level striping with parity bits, synchronized writes RAID 3: data striping at the bit level with parity disk, synchronized writes RAID 4: data striping at block level with parity disk RAID 5: scattered parity RAID 6: handles multiple disk failures 10/20/2010 CSC 2/456 23 10/20/2010 CSC 2/456 24 CSC 256/456 Fall 2010 6

Disk Management Swap Space Management Formatting Header: sector number etc. Footer/tail: ECC codes Gap Initialize mapping from logical block number to defectfree sectors Logical disk partitioning One or more groups of cylinders Sector 0: master boot record loaded by BIOS firmware, which contains partition information Boot record points to boot partition Part of file system? Requires navigating directory structure Disk allocation data structures Separate disk partition No file system or directory structure Optimize for speed rather than storage efficiency When is swap space created? 10/20/2010 CSC 2/456 25 10/20/2010 CSC 2/456 26 Disclaimer Parts of the lecture slides contain original work of Abraham Silberschatz, Peter B. Galvin, Greg Gagne, Andrew S. Tanenbaum, and Gary Nutt. The slides are intended for the sole purpose of instruction of operating systems at the University of Rochester. All copyrighted materials belong to their original owner(s). 10/20/2010 CSC 2/456 27 CSC 256/456 Fall 2010 7