Input/Output Systems

Similar documents
The Device Driver Interface. Input/Output Devices. System Call Interface. Device Management Organization

Chapter 13: I/O Systems

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)

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Slide 5-1. Device. Management. Operating Systems: A Modern Perspective, Chapter 5. Copyright 2004 Pearson Education, Inc.

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Module 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems

Chapter 13: I/O Systems

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

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

Chapter 13: I/O Systems

Module 12: I/O Systems

Chapter 13: I/O Systems

Chapter 13: I/O Systems

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

I/O Systems. 04/16/2007 CSCI 315 Operating Systems Design 1

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Chapter 13: I/O Systems

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

The control of I/O devices is a major concern for OS designers

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)

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

COT 4600 Operating Systems Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM

Lecture 15: I/O Devices & Drivers

CS420: Operating Systems. Kernel I/O Subsystem

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

Chapter 13: I/O Systems

Input/Output Systems

操作系统概念 13. I/O Systems

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

I/O SYSTEMS. Sunu Wibirama

[08] IO SUBSYSTEM 1. 1

Silberschatz and Galvin Chapter 12

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

I/O Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Module 11: I/O Systems

I/O Systems. Jo, Heeseung

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

Comp 204: Computer Systems and Their Implementation. Lecture 18: Devices

Operating Systems 2010/2011

CS330: Operating System and Lab. (Spring 2006) I/O Systems

Devices. Today. Comp 104: Operating Systems Concepts. Operating System An Abstract View 05/01/2017. Devices. Devices

NWI-IBC019: Operating systems

Today: I/O Systems. Architecture of I/O Systems

Operating Systems. Steven Hand. Michaelmas / Lent Term 2008/ lectures for CST IA. Handout 4. Operating Systems

I/O. CS 416: Operating Systems Design Department of Computer Science Rutgers University

Input-Output (I/O) Input - Output. I/O Devices. I/O Devices. I/O Devices. I/O Devices. operating system must control all I/O devices.

Operating Systems 2010/2011

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

Input Output (IO) Management

Principles of Operating Systems CS 446/646

CS370 Operating Systems

UNIT-7. Overview of Mass Storage Structure

CSE 451: Operating Systems Winter I/O System. Gary Kimura

Chapter 5 Input/Output. I/O Devices

CS370 Operating Systems

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Outline of Today s Lecture. The Big Picture: Where are We Now?

Discussion Week 8. TA: Kyle Dewey. Tuesday, November 15, 11

5.b Principles of I/O Hardware CPU-I/O communication

QUIZ Ch.6. The EAT for a two-level memory is given by:

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

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

Operating Systems. V. Input / Output

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

I/O Management and Disk Scheduling. Chapter 11

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

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

Systems Architecture II

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

CSCI-GA Operating Systems I/O. Hubertus Franke

CS 134. Operating Systems. April 8, 2013 Lecture 20. Input/Output. Instructor: Neil Rhodes. Monday, April 7, 14

CIS 21 Final Study Guide. Final covers ch. 1-20, except for 17. Need to know:

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

Interconnecting Components

I/O CANNOT BE IGNORED

SAZ4B/SAE5A Operating System Unit : I - V

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

Storage. Hwansoo Han

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

Chapter 8. A Typical collection of I/O devices. Interrupts. Processor. Cache. Memory I/O bus. I/O controller I/O I/O. Main memory.

-Device. -Physical or virtual thing that does something -Software + hardware to operate a device (Controller runs port, Bus, device)

Computer System Overview

15: OS Scheduling and Buffering

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

OPERATING SYSTEM OVERVIEW

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Example Networks on chip Freescale: MPC Telematics chip

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Computer Systems Laboratory Sungkyunkwan University

19: I/O. Mark Handley. Direct Memory Access (DMA)

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Lecture 1 Introduction (Chapter 1 of Textbook)

CS510 Operating System Foundations. Jonathan Walpole

Transcription:

CSE325 Principles of Operating Systems Input/Output Systems David P. Duggan dduggan@sandia.gov April 2, 2013

Input/Output Devices Output Device Input Device Processor 4/2/13 CSE325 - I/O Systems 2

Why we care about I/O? CPU Performance: 50% to 100% improvement per year I/O system performance limited by mechanical delays < 5% per year (IO per sec or MB per sec) Amdahl's Law: system speed-up limited by the slowest part! 10% IO & 10x CPU 5x Performance (lose 50%) 10% IO & 100x CPU 10x Performance (lose 90%) I/O bottleneck: Diminishing fraction of time in CPU Diminishing value of faster CPUs 4/2/13 CSE325 - I/O Systems 3

I/O Systems 4/2/13 CSE325 - I/O Systems 4

A Typical PC Motherboard 4/2/13 CSE325 - I/O Systems 5

A Typical PC Bus Structure 4/2/13 CSE325 - I/O Systems 6

Device I/O Port Locations on PCs (partial) 4/2/13 CSE325 - I/O Systems 7

The Device Driver Interface write( ); Abstract Software Interfaces Device Interface Terminal Driver Printer Driver Disk Driver Terminal Controller Printer Controller Disk Controller 4/2/13 CSE325 - I/O Systems 8

Device Management Organization System Interface Application Process File Manager Hardware Interface Device-Independent Device-Dependent Why 2 layers? Command Status Data Device Controller 4/2/13 9

A Kernel I/O Structure 4/2/13 10

Trap Table Device Independent Function Call func i ( ) dev_func_i(devid, ) { // Processing common to all devices switch(devid) { case dev0: dev0_func_i( ); break; case dev1: dev1_func_i( ); break; case devm: devm_func_i( ); break; }; // Processing common to all devices } 4/2/13 11

System Call Interface Functions available to application programs Abstract all devices (and files) to a few interfaces Make interfaces as similar as possible Block vs character Sequential vs direct access Device driver implements functions (one entry point per API function) open Prepare dev for operation close No longer using the device ioctl Character dev specific info read Character dev input op write Character dev output op strategy Block dev input/output ops select Character dev check for data stop Discontinue a stream output op 4/2/13 12

Operation of a Device... read(dev_i, %d, x); y = f(x)...... startread(dev_i, %d, x);... While(stillReading()) ; y = f(x)... Data on device Problem? Variable x Register Device dev_i Memory CPU 4/2/13 13

Overlapping Processing and I/O App 1 App 2 I/O Ctlr t 1 t 2 t 3 t 4 4/2/13 CSE325 - I/O Systems 14

Overlapping CPU-Controller Operations in a Process App I/O Ctlr t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 4/2/13 CSE325 - I/O Systems 15

Polling I/O Read Operation read(device, ); System Interface 1 Data 2 3 4 read function write function 5 Is there a performance problem? Low CPU utilization Hardware Interface Command Status Data Device Controller 4/2/13 CSE325 - I/O Systems 16

Interrupt-driven I/O Operation 1 System Interface read(device, ); Data 9 8b Device Status Table 3 2 read driver write driver 4 7 Device Handler Interrupt Handler 6 8a Hardware Interface 5 Command Status Data Device Controller 4/2/13 CSE325 - I/O Systems 17

Handling Interrupts Device driver J int read( ) { // Prepare for I/O save_state(j); out dev# // Done (no return) } Device status table J Device interrupt handler J void dev_handler( ) { get_state(j); //Cleanup after op signal(dev[j]); return_from_sys_call(); } Interrupt Handler Device Controller 4/2/13 CSE325 - I/O Systems 18

Handling Interrupts(2) Device driver J int read( ) { out dev# // Return after interrupt wait(dev[j}); return_from_sys_call(); } Device interrupt handler J void dev_handler( ) { //Cleanup after op signal(dev[j]); } Interrupt Handler Device Controller 4/2/13 CSE325 - I/O Systems 19

Intel Pentium Processor Event- Vector Table 4/2/13 20

Direct Memory Access Used to avoid programmed I/O for large data movement Requires DMA controller Bypasses CPU, transfers data directly between I/O device and memory 4/2/13 CSE325 - I/O Systems 21

Six Step Process to Perform DMA Transfer 4/2/13 CSE325 - I/O Systems 22

Characteristics of I/O Devices 4/2/13 CSE325 - I/O Systems 23

Block and Character Devices Block devices, e.g., disk drives Commands include read, write, seek Raw I/O or file-system access Memory-mapped file access possible Character devices, e.g., keyboards, mice, serial ports Commands include get, put Libraries layered on top allow line editing 4/2/13 CSE325 - I/O Systems 24

Blocking and Nonblocking I/O Blocking - process suspended until I/O completed Easy to use and understand Insufficient for some needs Nonblocking - I/O call returns as much as available User interface, data copy (buffered I/O) Implemented via multi-threading Returns quickly with count of bytes read or written Asynchronous - process runs while I/O executes Can be difficult to use I/O subsystem signals process when I/O completed 4/2/13 CSE325 - I/O Systems 25

Two I/O Methods Synchronous" Asynchronous" 4/2/13 CSE325 - I/O Systems 26

Kernel I/O Subsystem Scheduling Some I/O requests ordered via per-device queue Some OSs try fairness Priority of VM subsystem over app requests Buffering - store data in memory while transferring between devices To cope with device speed mismatch To cope with device transfer size mismatch To maintain copy semantics 4/2/13 CSE325 - I/O Systems 27

Device-status Table 4/2/13 CSE325 - I/O Systems 28

Error Handling OS must recover from disk read, device unavailable, transient write failures Most return an error number or code when I/O request fails System error logs hold problem reports 4/2/13 CSE325 - I/O Systems 29

I/O Protection User process may accidentally or purposefully attempt to disrupt normal operation via illegal I/O instructions All I/O instructions defined to be privileged I/O must be performed via system calls Database? Memory-mapped and I/O port memory locations must be protected too 4/2/13 CSE325 - I/O Systems 30

System Call Use to Perform I/O 4/2/13 31

Kernel Data Structures Kernel keeps state info for I/O components, including open file tables, network connections, character device state Many, many complex data structures to track buffers, memory allocation, dirty blocks Some use object-oriented methods and message passing to implement I/O 4/2/13 CSE325 - I/O Systems 32

UNIX I/O Kernel Structure 4/2/13 CSE325 - I/O Systems 33

I/O Requests to Hardware Operations Consider reading a file from disk for a process: Determine device holding file Translate name to device representation Physically read data from disk into buffer Make data available to requesting process Return control to process 4/2/13 CSE325 - I/O Systems 34

Life Cycle of An I/O Request 4/2/13 CSE325 - I/O Systems 35

Performance I/O a major factor in system performance: Demands CPU to execute device driver, kernel I/O code Context switches due to interrupts Data copying Network traffic especially stressful 4/2/13 CSE325 - I/O Systems 36

Improving Performance Reduce number of context switches Reduce data copying Reduce interrupts by using large transfers, smart controllers, polling Use DMA Balance CPU, memory, bus, and I/O performance for highest throughput 4/2/13 CSE325 - I/O Systems 37

Hardware Buffering Process Process Process Controller Controller Controller Data A B A B Device Device Device Unbuffered Process reads b i-1 Controller reads b i Process reads b i Controller reads b i+1 4/2/13 38