I/O Systems. Jo, Heeseung

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

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

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

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

Hard Disk Drives (HDDs)

Device-Functionality Progression

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

Input/Output Systems

Module 12: I/O Systems

Chapter 13: I/O Systems

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

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

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

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

Chapter 13: I/O Systems

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

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)

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

Chapter 12: I/O Systems

Chapter 13: I/O Systems

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

Chapter 13: I/O Systems

Chapter 13: I/O Systems

Module 12: I/O Systems

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

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

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

CS370 Operating Systems

Silberschatz and Galvin Chapter 12

Module 11: I/O Systems

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.

Input/Output Systems

I/O SYSTEMS. Sunu Wibirama

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

Operating Systems. V. Input / Output

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

Chapter 13: I/O Systems

CS370 Operating Systems

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

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

NWI-IBC019: Operating systems

Lecture 15: I/O Devices & Drivers

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

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

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

Chapter 13: I/O Systems

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

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

[08] IO SUBSYSTEM 1. 1

Hardware OS & OS- Application interface

CSCI-GA Operating Systems I/O. Hubertus Franke

Answer to exercises chap 13.2

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

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

Input / Output. School of Computer Science G51CSA

Operating Systems, Fall

Chapter 13: I/O Systems

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

Operating Systems 2010/2011

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

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)

C02: Interrupts and I/O

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

I/O Management and Disk Scheduling. Chapter 11

Chapter 5 Input/Output. I/O Devices

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

Organisasi Sistem Komputer

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

Operating Systems (CS1022) Input/Output. Yagiz Özbek Evren

I/O Management Intro. Chapter 5

Input / Output. Kevin Webb Swarthmore College April 12, 2018

I/O Devices. I/O Management Intro. Sample Data Rates. I/O Device Handling. Categories of I/O Devices (by usage)

Input/Output Problems. External Devices. Input/Output Module. I/O Steps. I/O Module Function Computer Architecture

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

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

Computer System Overview

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

OPERATING SYSTEMS CS136

Introduction I/O 1. I/O devices can be characterized by Behavior: input, output, storage Partner: human or machine Data rate: bytes/sec, transfers/sec

CS 450 Fall xxxx Final exam solutions. 2) a. Multiprogramming is allowing the computer to run several programs simultaneously.

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

ECE331: Hardware Organization and Design

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

CS510 Operating System Foundations. Jonathan Walpole

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

Operating Systems. V. Input / Output. Eurecom

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

Operating Systems CMPSC 473. Input/Output April 22, Lecture 22 Instructor: Trent Jaeger

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

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Chap. 3. Input/Output

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.

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

Input/Output Management

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

I/O Management Intro. Chapter 5

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Storage. Hwansoo Han

Transcription:

I/O Systems Jo, Heeseung

Today's Topics Device characteristics Block device vs. Character device Direct I/O vs. Memory-mapped I/O Polling vs. Interrupts Programmed I/O vs. DMA Blocking vs. Non-blocking I/O I/O software layers 2

A Typical PC Bus Structure 3

A Kernel I/O Structure 4

I/O Devices (1) Block device Stores information in fixed-size blocks Each one with its own address 512B - 32KB per block Read or write each block independently of all the other ones Disks, tapes, etc. Character device Delivers or accepts a stream of characters Not addressable and no seek operation Printers, modem, mice, keyboards, etc. 5

I/O Devices (2) USB 2.0: 60 MB/s USB 3.0: 625 MB/s SATA: SATA2: SATA3: 1.5 Gb/s 3 Gb/s 6 Gb/s PCIe 1.0: 250 MB/s PCIe 2.0: 500 MB/s PCIe 3.0: 984 MB/s PCIe 4.0: 1.9 GB/s 6

I/O Devices (3) Device controller (or host adapter) I/O devices have components: - Mechanical component - Electronic component (has the device controller) Device controller - May be able to handle multiple devices Controller's tasks - Convert serial bit stream to block of bytes - Make available to main memory - Perform error correction as necessary 7

I/O Hardware I/O instructions control devices Devices usually have registers Device driver places commands, addresses, and data to write, or read data from registers after command execution Data-in register, data-out register, status register, control register Typically 1-4 bytes, or FIFO buffer Devices have addresses, used by Direct I/O instructions Memory-mapped I/O - Device data and command registers mapped to processor address space 8

Accessing I/O Devices (1) Direct I/O Use special I/O instructions to an I/O port address 9

Accessing I/O Devices (2) Memory-mapped I/O The device control registers are mapped into the address space of the processor - The CPU executes I/O requests using the standard data transfer instructions I/O device drivers can be written entirely in C No special protection mechanism is needed - Protection via PTE - Including the desired pages in its page table - Can give a user control over specific devices Reading a device register and testing its value is done with a single instruction 10

Polling vs. Interrupts (1) How can a CPU knows I/O requests are processed? Polled I/O CPU asks ("polls") devices if need attention - Ready to receive a command - Command status, etc. Advantages - Simple - Software is in control - Efficient if CPU finds a device to be ready soon Disadvantages - Inefficient in non-trivial system (high CPU utilization) - Low priority devices may never be serviced 11

Polling vs. Interrupts (2) Interrupt-driven I/O I/O devices request interrupt when need attention Interrupt service routines specific to each device are invoked Interrupts can be shared between multiple devices Advantages - CPU only attends to device when necessary - More efficient than polling in general Disadvantages - Excess interrupts slow (or prevent) program execution - Overheads (may need 1 interrupt per byte transferred) 12

Polling vs. Interrupts (3) Interruptdriven I/O 13

Polling vs. Interrupts (4) 14

Programmed I/O vs. DMA (1) Data transfer modes in I/O Programmed I/O (PIO) - CPU is involved in moving data between I/O devices and memory - By special I/O instructions vs. by memory-mapped I/O DMA (Direct Memory Access) - Used for high-speed I/O devices able to transmit information at close to memory speeds - Device controller transfers blocks of data from buffer storage directly to main memory Without CPU intervention - Only an interrupt is generated per block 15

Programmed I/O vs. DMA (2) DMA (Direct Memory Access) Bypasses CPU to transfer data directly between I/O device and memory Used to avoid programmed I/O for large data movement 16

Six Step Process to Perform DMA Transfer 17

Blocking vs. Non-blocking I/O Blocking I/O Process is suspended until I/O completed Easy to use and understand read(), write() Non-blocking I/O I/O call returns quickly, with a return value that indicates how many bytes were transferred Implemented via multi-threading select() to find if data is ready 18

Goals of I/O Software Goals Device independence Uniform naming Error handling Synchronous vs. asynchronous Buffering Sharable vs. dedicated devices 19

I/O Software Layers User-level I/O Software Device-independent I/O Software Device Drivers Interrupt Handlers Hardware Network 20

Device Drivers (1) Device drivers User-level I/O Software Device-independent I/O Software Device Drivers Interrupt Handlers Device-specific code to control each I/O device Interacting with device-independent I/O software and interrupt handlers Requires to define a well-defined model and a standard interface of how they interact with the rest of the OS Implementing device drivers: - Statically linked with the kernel - Selectively loaded into the system during boot time - Dynamically loaded into the system during execution (especially for hot pluggable devices) Hardware 22

Device Drivers (2) 23

Device Drivers (3) The problem Reliability remains a crucial, but unresolved problem - 5% of Windows systems crash every day - Huge cost of failures: stock exchange, e-commerce, - Growing "unmanaged systems": digital appliances, consumer electronics devices Device driver extensions are increasingly prevalent - 70% of Linux kernel code - Over 35,000 drivers with over 120,000 versions on Windows XP - Written by less experienced programmer Leading cause of OS failure - Drivers cause 85% of Windows XP crashes - Drivers are 7 times buggier than the kernel in Linux 24

Device-Independent I/O SW (1) Uniform interfacing for device drivers User-level I/O Software Device-independent I/O Software Device Drivers Interrupt Handlers Hardware In Unix, devices are modeled as special files - They are accessed through the use of system calls such as open(), read(), write(), close(), ioctl(), etc. - A file name is associated with each device Major device number locates the appropriate driver - Minor device number (stored in i-node) is passed as a parameter to the driver in order to specify the unit The usual protection rules for files also apply to I/O devices /dev directory 25

Device-Independent I/O SW (2) Error reporting Errors must be reported to user Many errors are device-specific Must be handled by the appropriate driver Programming errors vs. actual I/O errors Handling errors Returning the system call with an error code Retrying a certain number of times Ignoring the error Killing the calling process Terminating the system 27

Device-Independent I/O SW (3) Allocating and releasing dedicated devices Some devices cannot be shared Require processes to perform open() on the special files for devices directly - The process retries if open() fails Have special mechanisms (not open()) for requesting and releasing dedicated devices - An attempt to acquire a device that is not available blocks the caller Device-independent block size Treat several sectors as a single logical block The higher layers only deal with abstract devices that all use the same block size 28

User-Space I/O Software Provided as a library Standard I/O library in C - fopen() vs. open()? User-level I/O Software Device-independent I/O Software Device Drivers Interrupt Handlers Hardware User's choice which library function to use fgets(), fscanf(),... Or, you can make your own I/O library myopen(), myfgets(),... 29

I/O Systems Layers 30