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

Similar documents
Device-Functionality Progression

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

Module 12: I/O Systems

I/O Systems. Jo, Heeseung

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

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

I/O AND DEVICE HANDLING Operating Systems Design Euiseong Seo

Chapter 13: I/O Systems

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

NWI-IBC019: Operating 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)

Chapter 13: I/O Systems

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

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

Module 12: I/O Systems

Chapter 13: I/O Systems

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

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

Chapter 12: I/O Systems

Chapter 13: I/O Systems

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

Module 11: I/O Systems

Chapter 13: I/O Systems

[08] IO SUBSYSTEM 1. 1

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

Chapter 13: I/O Systems

Input/Output Systems

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

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

Chapter 5 Input/Output. I/O Devices

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

Lecture 15: I/O Devices & Drivers

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

Input/Output Systems

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

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

Chapter 13: I/O Systems

Operating Systems 2010/2011

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

Common Computer-System and OS Structures

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

Chapter 13: I/O Systems

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

Operating Systems, Fall

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

I/O SYSTEMS. Sunu Wibirama

Operating system Dr. Shroouq J.

C02: Interrupts and I/O

Silberschatz and Galvin Chapter 12

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)

Bus System. Bus Lines. Bus Systems. Chapter 8. Common connection between the CPU, the memory, and the peripheral devices.

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

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

Computer System Overview

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

ECE 341. Lecture # 19

Operating Systems. V. Input / Output

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

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

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

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

Computer-System Structures

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

I/O Management Intro. Chapter 5

Introduction. CS3026 Operating Systems Lecture 01

EE458 - Embedded Systems Exceptions and Interrupts

File systems: management 1

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

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

Answer to exercises chap 13.2

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

Input / Output. School of Computer Science G51CSA

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

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

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

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

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.

Organisasi Sistem Komputer

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

CSCI-GA Operating Systems I/O. Hubertus Franke

Operating Systems, Fall

Computer Science 61C Spring Friedland and Weaver. Input/Output

Input Output (IO) Management

Task Based Programming Revisited Real Time Operating Systems

Unit 2 : Computer and Operating System Structure

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

Input/Output Management

CS3600 SYSTEMS AND NETWORKS

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

Eastern Mediterranean University School of Computing and Technology INPUT / OUTPUT

Chapter 1: Introduction

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

Secondary storage. CS 537 Lecture 11 Secondary Storage. Disk trends. Another trip down memory lane

I/O. Disclaimer: some slides are adopted from book authors slides with permission 1

Lecture 1 Introduction (Chapter 1 of Textbook)

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

Outline. Introduction. Survey of Device Driver Management in Real-Time Operating Systems

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Transcription:

Discussion Week 8 TA: Kyle Dewey

Overview Exams Interrupt priority Direct memory access (DMA) Different kinds of I/O calls Caching What I/O looks like

Exams

Interrupt Priority Process 1 makes an I/O request Process 2 makes an I/O request While setting up Process 2 s request, Process 1 s request finishes

Interrupt Priority Process 1 I/O Start I/O Done Time -> Process 2 I/O Start

Prioritizing While servicing one interrupt, another interrupt occurred Question: should we finish our ISR or allow the other ISR to run immediately?

Prioritizing Which ISRs preempt which is potentially complex Preemption within the kernel can be complex Similar issues as with process preemption

Performing I/O I/O takes forever, so while we do I/O, we schedule something else....so how do we do I/O if we re doing something else?

DMA Controller Answer: special hardware Dedicated processor just for handling I/O The processor directly manipulates memory and the I/O device, bypassing the CPU

DMA Messages Read X bytes starting at Y part of disk into Z part of memory Write X bytes to disk starting at part Y of disk from Z part of memory

DMA in Action Time 1 Time 2 CPU Write 3b M: 1; D: 0 DMA CPU Schedules Process DMA Controller Does I/O Memory Memory x f o o x f o o Disk Disk a b c d f b c d

DMA in Action Times 3-4 Time 5 CPU Runs Process DMA Controller Does I/O CPU I/O Done DMA Memory Memory x f o o Disk f o o d x f o o Disk f b c d

DMA Issues Question: How does this work in with virtual memory? Question: How does this work with swappable pages?

I/O Types

Blocking/Nonblocking Blocking: wait until I/O is complete until returning Nonblocking: on each call, return what has been done so far

Nonblocking Question: Why is this useful? Consider a program that gets the sum of integers from a 1 GB file

Synchronous/ Asynchronous Synchronous: wait for I/O to complete before returning Asynchronous: do not wait for I/O to complete before returning Ideally, there is a callback to signal when the I/O is complete

Asynchronous vs. Nonblocking DMA is asynchronous Asynchronous is still all or nothing, like a typical synchronous blocking I/O Nonblocking can get partial results Note: Wikipedia lies

I/O Calls Synchronous Asynchronous Blocking Common Depends... Nonblocking Nonsensical Possible

But I/O is still slow...

Caching Idea: Do as much I/O in memory as possible file = open( filename, O_RDWR ); read( file, buffer, 50 );... // more code that changes buffer lseek( file, 0, SEEK_SET ); write( file, buffer, 50 ); close( file )

Caching Massive performance gains possible Real systems use this all the time Can be quite complex

UNIX Semantics A write() is immediately available to anything that calls read() How does this work with caching?

Consistency Cache is by definition a copy of the actual resource Any access to that resource must behave as if caching is not being performed They will be out of sync, but they cannot look out of sync

Example Revisited How does the OS handle this? file = open( filename, O_RDWR ); read( file, buffer, 50 );... // more code that changes buffer lseek( file, 0, SEEK_SET ); write( file, buffer, 50 ); strcpy( buffer, Poisoned buffer ); close( file )

The face of I/O

Variation

Variation I/O is extremely broad...yet we try to make it fit into a consistent interface Major differences in OSes are often seen in how they treat I/O

Broad Classes Character based: One character at a time is manipulated Examples: keyboards, mice, network cards Block based: Blocks of characters are manipulated at a time Examples: Hard drives, flash drives

Broad Classes Some manage not to fit into even these Example: tape drives A seek can take a long time - impractical under essentially any circumstance Character devices have no notion of seeking However, data is stored in blocks...

Floppy Drives Often used the same interface as tape drives More naturally a block device

Responding to I/O Interrupts or polling can be used Some support both Which is best depends on usage scenario Polling makes little sense for hard drives - why? Interrupts are not usually used for mice - why?

I/O Space I/O devices often have a limited amount of space they can work with internally If the OS fails to respond before this space fills, data can be lost Example: keyboards

Buffering Buffer: a place in memory to put this data Not *quite* the same as a cache Not a copy Note that a cache can also be a buffer, but a buffer is by definition not a cache