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.

Slides:



Advertisements
Similar presentations
I/O Systems Operating System Concepts chapter 13 CS 355
Advertisements

Discussion Week 4 TA: Kyle Dewey. Overview Project #1 debriefing System calls Project #2.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
OS Spring’03 Introduction Operating Systems Spring 2003.
I/O Systems CS 3100 I/O Hardware1. I/O Hardware Incredible variety of I/O devices Common concepts ◦Port ◦Bus (daisy chain or shared direct access) ◦Controller.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
I/O CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
UQC113S2 Interrupt driven IO. We have already seen the hardware support required to facilitate interrupts We will now look at the higher levels of software.
I/O Systems CSCI 444/544 Operating Systems Fall 2008.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Operating Systems Who’s in charge in there?. Types of Software Application Software : Does things we want to do System Software : Does things we need.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable Used to communicate with the user Printers Video display terminals.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
NETW 3005 I/O Systems. Reading For this lecture, you should have read Chapter 13 (Sections 1-4, 7). NETW3005 (Operating Systems) Lecture 10 - I/O Systems2.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-2: I/O Management (Review) Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O.
I/O Systems I/O Hardware Application I/O Interface
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
1 Module 12: I/O Systems n I/O hardware n Application I/O Interface n Kernel I/O Subsystem n Transforming I/O Requests to Hardware Operations n Performance.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 13: I/O Systems. 13.2/34 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 13: I/O Systems I/O Hardware Application I/O Interface.
Discussion Week 2 TA: Kyle Dewey. Overview Concurrency Process level Thread level MIPS - switch.s Project #1.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
XE33OSA Chapter 13: I/O Systems. 13.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 2 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 I/O through system calls Protection.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
I/O Software CS 537 – Introduction to Operating Systems.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Chapter 13: I/O Systems.
I/O Management.
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
CS703 - Advanced Operating Systems
Computer Architecture
CSCI 315 Operating Systems Design
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Module 12: I/O Systems I/O hardwared Application I/O Interface
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

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 Process 2 I/O Start I/O Done Time ->

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 CPUDMA Write 3b M: 1; D: 0 xfoo abcd Memory Disk Time 1Time 2 xfoo fbcd Memory Disk CPU Schedules Process DMA Controller Does I/O

DMA in Action Times 3-4Time 5 xfoo fbcd Memory Disk CPU Runs Process DMA Controller Does I/O xfoo food Memory Disk CPUDMA I/O Done

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/Asynch ronous 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 Asynchronou s BlockingCommonDepends... NonblockingNonsensicalPossible

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 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 ) How does the OS handle this?

The face of I/O

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