Module 11: I/O Systems

Similar documents
Chapter 13: I/O Systems

Module 12: 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

Chapter 13: I/O Systems

Module 12: I/O Systems

Input/Output Systems

Chapter 13: 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

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

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

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

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

Silberschatz and Galvin Chapter 12

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

Chapter 13: I/O Systems

Chapter 13: I/O Systems

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

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. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Chapter 13: I/O Systems

Lecture 15: I/O Devices & Drivers

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

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

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

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

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.

[08] IO SUBSYSTEM 1. 1

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

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

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

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

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

NWI-IBC019: Operating systems

Operating Systems 2010/2011

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

I/O SYSTEMS. Sunu Wibirama

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

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

Input/Output Systems

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)

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

I/O Systems. Jo, Heeseung

Principles of Operating Systems CS 446/646

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

Operating Systems 2010/2011

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)

Input / Output. School of Computer Science G51CSA

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

Input/Output Management

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

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

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

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

OPERATING SYSTEMS CS136

CS370 Operating Systems

I/O Management Intro. Chapter 5

UNIT-7. Overview of Mass Storage Structure

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

Scuola Superiore Sant Anna. I/O subsystem. Giuseppe Lipari

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

CS420: Operating Systems. Kernel I/O Subsystem

VIII. Input/Output Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term

Operating Systems. V. Input / Output

I/O Management and Disk Scheduling. Chapter 11

CS370 Operating Systems

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

Operating Systems. Lecture 09: Input/Output Management. Elvis C. Foster

or edit a file, our immediate interest is to read or enter some information, not to compute an answer.

CSCI-GA Operating Systems I/O. Hubertus Franke

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

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


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

Computer System Overview

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

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09

Generic Model of I/O Module Interface to CPU and Memory Interface to one or more peripherals

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

Computer Architecture CS 355 Busses & I/O System

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

Input Output (IO) Management

Operating System 1 (ECS-501)

Organisasi Sistem Komputer

Answer to exercises chap 13.2

Storage. Hwansoo Han

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

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

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

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

Chapter 5 Input/Output. I/O Devices

CSI3131 Final Exam Review

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

Transcription:

Module 11: I/O Systems Reading: Chapter 13 Objectives Explore the structure of the operating system s I/O subsystem. Discuss the principles of I/O hardware and its complexity. Provide details on the performance aspects of the I/O hardware and software.

I/O Systems Controller Port Bus Introduction I/O Hardware I/O Techniques Kernel I/O Subsystem Application I/O Interface

Types of I/O Devices For human usage printers monitors keyboard For the machine disks, tapes For communication modems, network cards...

Main Characteristics Speed (data rate) enormous differences Unit of data transfer Byte stream (ex: keyboard) Blocks (ex: disk) Data representation Different data encoding schemes adopted (character codes, parity conventions...) Error conditions Nature of errors and responses vary a lot Still, we want to have as simple and unified view of them as possible

I/O Hardware I/O Port Connection point for communicating with device Bus wires + protocol Shared connection point Controller Electronics controlling port/bus/device Has control registers i.e. data-in, data-out, status, control + other stuff (buffers, ) Devices have addresses Direct I/O instructions Memory-mapped I/O

A Typical PC Bus Structure PCI: Peripheral Component Interconnect

Communication between CPU and I/O Controllers Two basic techniques: CPU accesses controller registers. CPU and controllers can exchange data via zones in main memory Combination of both techniques Contr. CPU Periph. RAM

Device I/O Port Locations on PCs (partial)

I/O Systems Controller Port Bus Introduction DMA Interrupts Polling I/O Hardware I/O Techniques Kernel I/O Subsystem Application I/O Interface

I/O using Polling CPU reads/writes the I/O Port/Controller registers Handshaking between the CPU and the controller Ready bit in a register indicates if the controller is busy (=1) ore can accept a new command (=0). Busy-waiting/polling necessary when ready bit indicates device is busy Low overhead if ready bit becomes 0 soon But lots of waste (busy waiting) if the ready bit remains at 1 for a long time Solution? interrupts

Interrupts Idea: don t poll the device, but let the device tell the CPU when it is ready How the device signals to the CPU? Interrupt-request line triggered by I/O device How does the CPU know which device was involved? Can poll all devices From the interrupt # Index to the Interrupt Vector table, pointing to Interrupt Handlers

Interrupt-Driven I/O Cycle

Intel Pentium Processor Event-Vector Table

Interrupts Interrupt attributes Maskable/non-maskable Interrupt priorities Interrupt uses Interrupt-based I/O Handling exceptions Invoking OS kernel (system calls) Managing flow of control

Direct Memory Access (DMA) In systems with no DMA, the CPU is involved in the transfer of each byte. Contr UCT Mém DMA is used to exclude the involvement of the CPU, particularly for large I/O. Requires a special controller The controller accesses memory directly DMA still slows the CPU, since it uses the bus to the memory which prevents the CPU from using it But much less than having the CPU more involved in the I/O. Contr. c DMA UCT Mém

Direct Memory Access 6 Steps

I/O Systems Controller Port Bus Introduction DMA Interrupts Polling I/O Hardware I/O Techniques Kernel I/O Subsystem Application I/O Interface Block Devices Network Devices Device Catagories Character Devices Clocks and Timers Device Characteristics Blocking and Non-Blocking I/O

Application I/O Interface the OS must perform the I/O on behalf of the user processes ideally, all I/O devices would be accessed in a uniform way OS hides hardware differences behind a uniform API in reality, the I/O devices are way too different block or stream oriented only read, only write, read/write sequential/random access synchronous/asynchronous vastly different transfer rates sharable/dedicated

Characteristics of I/O Devices

Application I/O Interface Modular, hierarchical, multi-layered model is generally used The I/O system encapsulates the behaviour of peripherals into major device categories: Block I/O or Character-stream I/O Memory-mapped file Network sockets Additional standard devices Clock, timer The driver layer masks the differences between the various peripherals Backdoor function for sending arbitrary commands to controllers If the device is very specialized and none of the methods from the interface fit well To fully exploit the device s additional functionality Unix - ioctl(fd, command, args) The developer of drivers must create a driver for each type of operating system

A Kernel I/O Structure

Block and Character Devices Block devices include disk drives Commands include read, write, seek Managed by file-system Raw I/O can be used (i.e. databases) Compromise: direct I/O FS, but not buffering/locking Memory-mapped file access possible Character devices include keyboards, mice, serial ports Commands include get, put Libraries layered on top to allow line editing

Network Devices Varying enough from block and character to have own interface Unix and Windows NT/9x/2000 include socket interface Separates network protocol from network operation Includes select functionality Approaches vary widely (pipes, FIFOs, streams, queues, mailboxes)

Clocks and Timers Provide current time, elapsed time, timer Programmable interval timer used for timings, periodic interrupts ioctl (on UNIX) covers odd aspects of I/O such as clocks and timers Other calls such as sleep(), alarm(), getitimer(), and setitimer() provide timing services

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) Returns quickly with count of bytes read or written Can be implemented using multithreading and blocking I/O Asynchronous - process runs while I/O executes Difficult to use I/O subsystem signals process when I/O completed

Two I/O Methods Synchronous Asynchronous

I/O Systems Controller Port Bus Introduction DMA Interrupts Polling I/O Hardware I/O Techniques Kernel I/O Subsystem I/O Scheduling Buffering/Caching/Spooling Error Handing/Protection Kernel Data Structures Application I/O Interface Block Devices Network Devices Device Catagories Character Devices Clocks and Timers Device Characteristics Blocking and Non-Blocking I/O

I/O Management Objectives Efficiency I/O operations are much slower than processor operations quite often I/O is the bottleneck any inefficiency in I/O directly impacts the whole system performance what can be done? use DMA or interrupt driven I/O schedule the processes so that the I/O devices are fully utilized rearrange I/O requests to allow more efficient use of the I/O device disk scheduling Use buffering & caching Error handling Protection of the I/O devices

Kernel I/O Subsystem I/O Scheduling I/O request ordering via per-device queue Example: disc scheduling Goals: efficiency, fairness, priorities Buffering - store data in memory while transferring between devices Double buffering To cope with device speed mismatch To cope with device transfer size mismatch To maintain copy semantics

Kernel I/O Subsystem Caching - fast memory holding copy of data Always just a copy Key to performance Spooling - hold output for a device If device can serve only one request at a time i.e., Printing Device reservation - provides exclusive access to a device System calls for allocation and deallocation Watch out for deadlock

Kernel I/O Subsystem Summary Name space management which device is this file on? Access control who can access this file/device? Operations control - which operations are possible on this device File-System space allocation Device allocation Buffering, caching, spooling I/O scheduling Device-status monitoring, error handling and failure recovery Device driver configuration and initialization Device drivers provide a uniform interface for accessing devices to the upper layers

Example: I/O Request Life Cycle

I/O Systems Controller Port Bus Introduction DMA Interrupts Polling I/O Hardware I/O Techniques Kernel I/O Subsystem I/O Scheduling Buffering/Caching/Spooling Error Handing/Protection Kernel Data Structures Application I/O Interface Block Devices Network Devices Device Catagories Character Devices Clocks and Timers Device Characteristics Blocking and Non-Blocking I/O