Interfacing I/O devices to the Memory, Processor, and Operating System

Similar documents
1. Computer System Structure and Components

Quiz for Chapter 6 Storage and Other I/O Topics 3.10

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Robert Wagner

Chapter 11: Input/Output Organisation. Lesson 06: Programmed IO

RAID. RAID 0 No redundancy ( AID?) Just stripe data over multiple disks But it does improve performance. Chapter 6 Storage and Other I/O Topics 29

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Have both hardware and software. Want to hide the details from the programmer (user).

Computer Systems Structure Input/Output

Input / Output and I/O Strategies

I/O Device and Drivers

Devices and Device Controllers

Microprocessor & Assembly Language

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Computer Organization. and Instruction Execution. August 22

Big Picture. IC220 Set #11: Storage and I/O I/O. Outline. Important but neglected

Obj: Sec 1.0, to describe the relationship between hardware and software HW: Read p.2 9. Do Now: Name 3 parts of the computer.

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Input / Ouput devices. I/O Chapter 8. Goals & Constraints. Measures of Performance. Anatomy of a Disk Drive. Introduction - 8.1

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

lesson 1 An Overview of the Computer System

Chapter 1 Computer System Overview

CSE2102 Digital Design II - Topics CSE Digital Design II

BIOS Update Release Notes

Chapter 2: OS Overview

Linux Process Scheduling Policy

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

Central Processing Unit

Chapter Introduction. Storage and Other I/O Topics. p. 570( 頁 585) Fig I/O devices can be characterized by. I/O bus connections

Performance evaluation

Computer-System Architecture

Virtualization in Linux KVM + QEMU

Central Processing Unit (CPU)

Chapter 13. PIC Family Microcontroller

INPUT/OUTPUT ORGANIZATION

I/O. Input/Output. Types of devices. Interface. Computer hardware

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Read this before starting!

Operating Systems. Lecture 03. February 11, 2013

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

BIOS Update Release Notes

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

CS161: Operating Systems

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

What is a bus? A Bus is: Advantages of Buses. Disadvantage of Buses. Master versus Slave. The General Organization of a Bus

Buffer Management 5. Buffer Management

1 Storage Devices Summary

Prof. Dr. Ing. Axel Hunger Dipl.-Ing. Bogdan Marin. Operation Systems and Computer Networks Betriebssysteme und Computer Netzwerke

21152 PCI-to-PCI Bridge

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

Operating Systems 4 th Class

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

CSCA0102 IT & Business Applications. Foundation in Business Information Technology School of Engineering & Computing Sciences FTMS College Global

Chapter 1: Introduction. What is an Operating System?

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

Lecture 1 Operating System Overview

Device Management Functions

Chapter 11 I/O Management and Disk Scheduling

TIMING DIAGRAM O 8085

System Architecture. CS143: Disks and Files. Magnetic disk vs SSD. Structure of a Platter CPU. Disk Controller...

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

COMPUTER ARCHITECTURE. Input/Output

MC514 Sistemas Operacionais: Teoria e Prática 1s2006. Gerenciamento de Entrada e Saída

Router and Routing Basics

Hello, and welcome to this presentation of the STM32 SDMMC controller module. It covers the main features of the controller which is used to connect

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

CS 6290 I/O and Storage. Milos Prvulovic

Database Fundamentals

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

PCI-to-PCI Bridge Architecture Specification. Revision 1.1

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

The Real-Time Operating System ucos-ii

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

S7 for Windows S7-300/400

Types Of Operating Systems

Data Storage - I: Memory Hierarchies & Disks

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

CHAPTER 4 MARIE: An Introduction to a Simple Computer

MBP_MSTR: Modbus Plus Master 12

Operating System Components

MACHINE ARCHITECTURE & LANGUAGE

Phoenix SecureCore TM Setup Utility

Computer Architecture Prof. Mainak Chaudhuri Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Outline: Operating Systems

Common Operating-System Components

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

A Deduplication File System & Course Review

Lecture 9: Memory and Storage Technologies

Outline. Principles of Database Management Systems. Memory Hierarchy: Capacities and access times. CPU vs. Disk Speed

Computer Organization & Architecture Lecture #19

CPU Scheduling. CPU Scheduling

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

RAID Overview

Operating Systems. III. Scheduling.

Eureka Technology. Understanding SD, SDIO and MMC Interface. by Eureka Technology Inc. May 26th, Copyright (C) All Rights Reserved

Overhead and Performance Impact when Using Full Drive Encryption with HP ProtectTools and SSD

Low Profile Ultra ATA-133 RAID PCI Host

Transcription:

Interfacing I/O devices to the Memory, Processor, and Operating System How is a user I/O request transformed into a device command and communicated to the device? E.g., file read/write, mouse movement, keyboard stroke How is data actually transferred to or from a memory location? What is the role of the operating system? 20 Operating System Responsibilities wrt I/O system Characteristics of I/O devices Shared by multiple programs Interrupt driven Low-level control is complex OS functions Must provide protection E.g. must not allow file owned by one user to be deleted by another user Must provide abstractions for accessing device E.g. file abstraction for a collection of blocks on disk Must handle interrupts Must try to provide fairness in accessing I/O devices Must try and manage I/O devices so that throughput is maximized 21 1

Communication between I/O devices and the OS To perform its functions wrt I/O system, the operating system must be able to communicate with I/O devices and to prevent user programs from accessing the I/O devices directly Three types of communication OS must be able to give commands to I/O devices A device must be able to notify the OS when it has completed a command or if there is an error Data must be transferred between the I/O device and memory 22 Giving commands to I/O devices CPU must be able to address the device and to supply one or more commands Two methods for addressing the device Memory-mapped I/O Portions of a program s address space are assigned to I/O devices Reads and writes to these addresses are interpreted as commands to the device These memory addresses are not directly accessible to user programs Special I/O instructions I/O instructions can specify both the device number and the command word (or the location of the command word in memory) I/O instructions can only be executed by the operating system 23 2

Communication with the Processor Two methods Polling Device status bits are periodically checked to see if it is time for the next I/O operation Interrupt-driven I/O Device delivers interrupt to the CPU when it requires attention Interrupts are like exceptions except that they are not associated with any instruction CPU can check before starting a new instruction if an interrupt has been delivered Interrupt-handling: Can be vectored or can use a Cause register (Recall Exception-handling from Chapter 5) 24 Polling vs Interrupt-driven I/O Assume that the number of clock cycles for a polling operation is 100. For a processor executes at 50 MHz, what is the overhead of polling 1. For a mouse that is polled 30 times per second? 2. For a floppy disk that transfers data to the processor in 16-bit units and has a data transfer rate of 50 KB/second? 3. For a hard disk transferring data in 1 word chunks at 2 MB/sec? For the mouse clock cycles used per second for polling = 30 x 100 = 300 Fraction of processor cycles used for polling = 3000/(50 X 10 6) = 0.006% 25 3

Polling vs Interrupt-driven I/O cont d For the floppy drive Number of polling operations per second (if we don t want to lose data) = (50 KB/sec) / (2 bytes/access) = 25 K polling accesses per second Clock cycles for polling = 25 K X 100 = 25 X 1024 X 100 = 25.6 X 10 5 clock cycles per second Fraction of CPU cycles = (25.6 X 10 5 ) / (50 X 10 6 ) = 5% For the hard disk Rate of polling = (2 MB/sec)/ (4 bytes per access) = 500 K polling accesses per second Clock cycles = 500 K X 100 = 51.2 X 10 6 Fraction of CPU cycles = 51.2 X 10 6 / 50 X 10 6 = 100%!!!! 26 Polling vs Interrupt-driven I/O cont d Suppose overhead of interrupt handling is 100 clock cycles. How much overhead when floppy disk is active? Rate of interrupts = (50 KB/sec) / (2 bytes/interrupt) = 25 K interrupts per second Clock cycles for handling interrupts = 25 K X 100 = 25 X 1024 X 100 = 25.6 X 10 5 clock cycles per second Fraction of CPU cycles = (25.6 X 10 5 ) / (50 X 10 6 ) = 5% The difference from polling is that 5% of the CPU cycles per second are used for handling interrupts only if the floppy is busy At other times, overhead is 0%. For polling, the overhead is always 5% 27 4

Transferring data between device and memory Two methods Interrupt-driven I/O Processor is involved in data transfer Problem: 100% overhead in the case of the hard disk example Direct Memory Access (DMA) Data is transferred directly from the device to memory (or vice versa) Processor is involved only in 1. Initiating the DMA transfer 2. Handling interrupt at the end of DMA transfer 28 DMA Implemented with special controller that transfers data between memory and I/O device independent of the processor Three steps in DMA transfers 1. Processor sets up the DMA transfer by supplying identity of device, operation to perform, memory address that is source or destination of data, number of bytes to be transferred 2. DMA controller starts the operation (arbitrates for the bus, supplies address, reads or writes data), until the entire block is transferred 3. DMA controller interrupts the processor, which then takes the necessary actions 29 5

Hard disk DMA example Find overhead for using DMA for data transfer from a hard disk. Assume initial DMA setup = 1000 cycles Interrupt handling on DMA completion = 500 cycles Average size of data transfer = 4 KB Each DMA transfer takes (4 KB)/(2 MB/sec) = 2 X 10-3 seconds CPU cycles used for DMA transfer = 1000 + 500 = 1500 Total CPU cycles during DMA transfer = (50 X 10 6 ) X (2 X 10-3 ) = 100 X 10 3 Fraction of CPU cycles used for DMA = 1500 / 100 X 10 3 = 1.5 % 30 6