I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p. 495 - 527.

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
Part 5 (Stallings) Input/Output 5.1 Principles of I/O hardware
1 Input/Output Chapter Principles of I/O hardware 5.2 Principles of I/O software 5.3 I/O software layers 5.4 Disks 5.5 Clocks 5.6 Character-oriented.
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.
Lecture 7b I/O. I/O devices  Device (mechanical hardware)  Device controller (electrical hardware)  Device driver (software)
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.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
Operating System - Overview Lecture 2. OPERATING SYSTEM STRUCTURES Main componants of an O/S Process Management Main Memory Management File Management.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
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.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Input/Output The messiest part of O.S.
1 Device Management The von Neumann Architecture System Architecture Device Management Polling Interrupts DMA operating systems.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 3 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Chapter 5 Input/Output I/O Hardware I/O Software Software Layers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights.
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.
Operating Systems Input/Output Devices (Ch 5: )
I/O Systems CSCI 444/544 Operating Systems Fall 2008.
CSE 451: Operating Systems Winter 2010 Module 15 I/O Mark Zbikowski Gary Kimura.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Copyright ©: Nahrstedt, Angrave, Abdelzaher
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
1 I/O and Filesystems. 2 How to provide interfaces Rough reading guide (no exam guarantee): Tanenbaum Ch. 5.1 – 5.5 & Silberschatz Ch. 13 & ,
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
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.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CS399 New Beginnings Jonathan Walpole. Device Input/Output.
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 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.
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.
CS 333 Introduction to Operating Systems Class 15 - Input/Output Jonathan Walpole Computer Science Portland State University.
Advanced Programming for 3D Applications CE Bob Hobbs Staffordshire university Data Capture, Streams and Devices Lecture 11.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent University.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
12/8/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
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.
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.
Input/Output Chapter 5 Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
I/O Management.
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Chapter 5: I/O Systems.
Chapter 13: I/O Systems.
Presentation transcript:

I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Goals for I/O Handling  Enable use of peripheral devices  Present a uniform interface for  Users (files etc.)  Devices (respective drivers)  Hide the details of devices from users (and OS)

© DEEDS – OS Course WS11/12 Lecture 6 – I/O How to provide interfaces

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Hardware: Device Controllers  I/O devices have:  mechanical components  electronic components  The device controller component  may be able to handle multiple devices  is the device interface accessible to the OS  Controller's tasks  convert bit stream to block of bytes  perform error correction as necessary

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Device-Specific Properties  The mechanical/electronic properties of devices impact software  timing (seek times etc., e.g. SSD vs HDD)  interrupts  data rates

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Accessing Devices (1)  Most device controllers provide  buffers (in / out)  control registers  status registers  These are accessed from the OS/Apps  I/O ports  memory-mapped  hybrid

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Accessing Devices (2) a)Separate I/O and memory space b)Memory-mapped I/O c)Hybrid

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Memory-Mapped I/O + No special instruction in assembler needed + No special protection needed (remember VM) + Testing status registers directly Not load and test! -Caching of status registers? -One bus?

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Memory-Mapped I/O (a) A single-bus architecture (b) A dual-bus memory architecture

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Shuffling Data  Data needs to be sent  one byte at a time  several bytes at a time  Using the CPU to shuffle small amounts of data may be inefficient  Direct Memory Access (DMA)

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Direct Memory Access (DMA) Operation of a DMA transfer

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Interrupts Connections between devices and interrupt controller actually use interrupt lines on the bus rather than dedicated wires

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Goals of I/O Software  Device independence  programs can access any I/O device  without specifying device in advance (file on floppy, hard drive, or CD-ROM)  Uniform naming  name a file or device as a string or an integer  not depending on the device  Error handling  handle as close to the HW as possible

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Challenges for I/O Software  Synchronous vs. asynchronous transfers  blocking transfers vs. interrupt-driven  OS may make interrupt-driven operations look like blocking to the user  Buffering  data coming off a device cannot be stored in final destination  OS should buffer for pre-processing/RT…  Sharable vs. dedicated devices  disks are sharable  tape drives would not be  OS should be able to support both

© DEEDS – OS Course WS11/12 Lecture 6 – I/O I/O There are three kinds of I/O handling  Programmed I/O  “Do it all yourself”  Interrupt-driven I/O  “Here you are, now tell me when its done”  DMA-based I/O  “Let someone else do it”

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Programmed I/O

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Interrupt-Driven I/O Writing a string to the printer using interrupt-driven I/O Code for system callCode for interrupt handler

© DEEDS – OS Course WS11/12 Lecture 6 – I/O I/O Using DMA  Printing a string using DMA a) code executed when the print system call is made b) interrupt service procedure

© DEEDS – OS Course WS11/12 Lecture 6 – I/O I/O Software Layers Layers of the I/O Software System

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Interrupt Handlers  Interrupt handlers should be fast (why?)  Sometimes there is a lot of things to do  Copying buffers, waking up processes, starting new I/O ops, etc.  Solution: split in two parts  Top half: disabled interrupts, only essential work  Bottom half: enabled interrupts, does most of the work

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Interrupt Service Routine Steps that must be performed in software when interrupt occurs (no complete list) 1.Save regs not already saved by interrupt hardware 2.Set up context for interrupt service procedure 3.Ack interrupt controller (& reenable interrupts) 4.Run service procedure 5.Schedule and run a new process (+ new context)

© DEEDS – OS Course WS11/12 Lecture 6 – I/O  Logical position of device drivers is shown here  Communication between drivers and device controllers over the bus Device Drivers ( 1 )

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Device Drivers (2)  Classically we distinguish two types  Block devices (disks…)  Character devices (keyboards, printers…)  Handles (typically)  Abstract requests “reads” and “writes”  Communication with device controller  Initialization  Power management

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Device-Independent I/O Software (1) Functions of the device-independent I/O software Uniform interfacing for device drivers Buffering Error reporting Allocating and releasing dedicated devices Providing a device-independent block size Generic I/O management in the kernel

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Uniform Interfacing for Device Drivers (a) Without a standard driver interface (b) With a standard driver interface

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Uniform Interface: Naming  How are devices addressed?  UNIX/Linux  Major number Identifying the device driver  Minor number Identifying the (virtual) device

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Linux Driver Registration  Drivers (modules) need to register with the kernel  Kernel keeps table of drivers  Special kernel routines for adding/deleting entries More on that in the next lab!

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Buffering  Where to put the buffers  User  Kernel  What if the buffer is full?  How many buffers?  When to notify the user?

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Device-Independent I/O Software (a) Unbuffered input (b) Buffering in user space (c) Buffering in the kernel followed by copying to user space (d) Double buffering in the kernel

© DEEDS – OS Course WS11/12 Lecture 6 – I/O I/O Buffering  Where to store data to be sent?  User buffer Locking? When finished?  Kernel buffer No locking  Device controller

© DEEDS – OS Course WS11/12 Lecture 6 – I/O Device-Independent I/O Software Networking may involve many copies

© DEEDS – OS Course WS11/12 Lecture 6 – I/O User-Space I/O Software Layers of the I/O system and their main functions