Chapter 5: I/O Systems.

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)
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)
Chapter 5: I/O Systems.
1 I/O Devices Controller: physically controls the devices Devices are diverse and complicated Present simpler interface to OS E.g, convert a linear sector.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
1 Device Management The von Neumann Architecture System Architecture Device Management Polling Interrupts DMA operating systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
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.
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.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Copyright ©: Nahrstedt, Angrave, Abdelzaher
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.
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 & ,
Chapter 5: I/O Systems. Chapter 5 2 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Input/Output Principles of I/O hardware.
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.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
CS399 New Beginnings Jonathan Walpole. Device Input/Output.
I/O Systems I/O Hardware Application I/O Interface
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.
© 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.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
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.
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
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.
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.
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.
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
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.
Multiple Platters.
Operating Systems (CS 340 D)
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
Computer Architecture
CSCI 315 Operating Systems Design
© CHAROTAR INSTITUTE OF TECHNOLOGY, CHANGA
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
Clock hardware Chapter 5 CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt)
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
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:

Chapter 5: I/O Systems

How complex is the OS’s job? Let’s look at one of the resources managed by the OS: I/O devices Fall 2018 CS/COE 1550 – Operating Systems – Sherif Khattab

CS/COE 1550 – Operating Systems – Sherif Khattab Device controllers Electronic component controls the device May be able to handle multiple devices May be more than one controller per mechanical component (example: hard drive) Controller's tasks Convert serial bit stream to block of bytes Perform error correction as necessary Make available to main memory Block Devices A device that stores data in fixed‐sized blocks, each uniquely addressed, and can be randomly accessed Character Devices Device that delivers or accepts a stream of characters Fall 2018 CS/COE 1550 – Operating Systems – Sherif Khattab

Memory-Mapped I/O Memory I/O ports Separate I/O & memory space 0xFFF… I/O ports Separate I/O & memory space Memory-mapped I/O Hybrid: both memory-mapped & separate spaces CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Dynamic Frequency on XScale Fall 2018 CS/COE 1550 – Operating Systems – Sherif Khattab

How is memory-mapped I/O done? Single-bus All memory accesses go over a shared bus I/O and RAM accesses compete for bandwidth Dual-bus RAM access over high-speed bus I/O access over lower-speed bus Less competition More hardware (more expensive…) CPU Memory I/O CPU Memory I/O This port allows I/O devices access into memory CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Direct Memory Access (DMA) operation CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Hardware’s view of interrupts Bus CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

I/O software: goals Device independence Uniform naming Error handling Programs can access any I/O device No need to specify device in advance Uniform naming Name of a file or device is a string or an integer Doesn’t depend on the machine (underlying hardware) Error handling Done as close to the hardware as possible Isolate higher-level software Synchronous vs. asynchronous transfers Blocked transfers vs. interrupt-driven Buffering Data coming off a device cannot be stored in final destination Sharable vs. dedicated devices CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Programmed I/O: printing a page Printed page Printed page Printed page User ABCD EFGH ABCD EFGH ABCD EFGH A AB ABCD EFGH ABCD EFGH Kernel CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Polling copy_from_user (buffer, p, count); // copy into kernel buffer for (j = 0; j < count; j++) { // loop for each char while (*printer_status_reg != READY) ; // wait for printer to be ready *printer_data_reg = p[j]; // output a single character } return_to_user(); CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Interrupt-driven I/O Code run by system call copy_from_user (buffer, p, count); j = 0; enable_interrupts(); while (*printer_status_reg != READY) ; *printer_data_reg = p[0]; scheduler(); // and block user Code run by system call if (count == 0) { unblock_user(); } else { *printer_data_reg = p[j]; count--; j++; } acknowledge_interrupt(); return_from_interrupt(); Code run at interrupt time CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

I/O using DMA Code run by system call Code run at interrupt time copy_from_user (buffer, p, count); set_up_DMA_controller(); scheduler(); // and block user Code run by system call acknowledge_interrupt(); unblock_user(); return_from_interrupt(); Code run at interrupt time CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Layers of I/O software User User-level I/O software & libraries Device-independent OS software Operating system (kernel) Device drivers Interrupt handlers Hardware CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Interrupt handlers Interrupt handlers are “under the hood” Driver starts an I/O operation If it blocks, it calls scheduler for the next process When devide ends, interrupt notifies CPU of completion Interrupt service routine bottom half Perform minimal actions at interrupt time Save regs not already saved by interrupt hardware Set up context for rest of interrupt handler Then unblocks driver that started it Some of the functionality can be done by the driver after it is unblocked (top half) CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

What happens on an interrupt Set up stack for interrupt service procedure Ack interrupt controller, reenable interrupts Copy registers from where saved Run service procedure (optional) Pick a new process to run next Set up MMU context for process to run next Load new process' registers Start running the new process CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Device drivers User space Device drivers go between device controllers and rest of OS Drivers standardize interface to widely varied devices Device drivers communicate with controllers over bus Controllers communicate with devices themselves User program Kernel space Rest of the OS Keyboard driver Disk driver Keyboard controller Disk controller CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Why a standard driver interface? Non-standard driver interfaces Standard driver interfaces CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Buffering device input User space User space User space User space Kernel space Kernel space Kernel space Kernel space 2 2 1 1 3 Unbuffered input Buffering in user space Buffer in kernel Copy to user space Double buffer in kernel CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Anatomy of an I/O request CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5

Device-independent I/O software Device-independent I/O software provides common “library” routines for I/O software Helps drivers maintain a standard appearance to the rest of the OS Uniform interface for many device drivers for Buffering Error reporting Allocating and releasing dedicated devices Suspending and resuming processes Common resource pool Device-independent block size (keep track of blocks) Other device driver resources CS 1550, cs.pitt.edu (originaly modified by Ethan L. Miller and Scott A. Brandt) Chapter 5