Chapter 8. A Typical collection of I/O devices. Interrupts. Processor. Cache. Memory I/O bus. I/O controller I/O I/O. Main memory.

Similar documents
INPUT/OUTPUT DEVICES Dr. Bill Yi Santa Clara University

Lecture 13. Storage, Network and Other Peripherals

Chapter Seven Morgan Kaufmann Publishers

EE108B Lecture 17 I/O Buses and Interfacing to CPU. Christos Kozyrakis Stanford University

ECE331: Hardware Organization and Design

ECE232: Hardware Organization and Design

Virtual Memory Input/Output. Admin

Computer Architecture. Hebrew University Spring Chapter 8 Input/Output. Big Picture: Where are We Now?

CPS104 Computer Organization and Programming Lecture 18: Input-Output. Outline of Today s Lecture. The Big Picture: Where are We Now?

Introduction to Input and Output

Chapter 6. Storage and Other I/O Topics

Reading and References. Input / Output. Why Input and Output? A typical organization. CSE 410, Spring 2004 Computer Systems

Chapter 6 Storage and Other I/O Topics

INPUT/OUTPUT ORGANIZATION

INPUT/OUTPUT ORGANIZATION

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Computer Systems Laboratory Sungkyunkwan University

Buses. Disks PCI RDRAM RDRAM LAN. Some slides adapted from lecture by David Culler. Pentium 4 Processor. Memory Controller Hub.

INPUT/OUTPUT ORGANIZATION

CS152 Computer Architecture and Engineering Lecture 20: Busses and OS s Responsibilities. Recap: IO Benchmarks and I/O Devices

Systems Architecture II

Thomas Polzer Institut für Technische Informatik

Computer Architecture CS 355 Busses & I/O System

Module 6: INPUT - OUTPUT (I/O)

Where We Are in This Course Right Now. ECE 152 Introduction to Computer Architecture Input/Output (I/O) Copyright 2012 Daniel J. Sorin Duke University

Storage Systems. Storage Systems

Administrivia. CMSC 411 Computer Systems Architecture Lecture 19 Storage Systems, cont. Disks (cont.) Disks - review

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

Lecture 23. Finish-up buses Storage

COSC121: Computer Systems. Exceptions and Interrupts

Lectures More I/O

Chapter 6. I/O issues

IO System. CP-226: Computer Architecture. Lecture 25 (24 April 2013) CADSL

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Introduction I/O 1. I/O devices can be characterized by Behavior: input, output, storage Partner: human or machine Data rate: bytes/sec, transfers/sec

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

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)

ECE468 Computer Organization and Architecture. OS s Responsibilities

8. Interfacing Processors and Peripherals

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

FUNCTIONS OF COMPONENTS OF A PERSONAL COMPUTER

Storage, Networks, and Other Peripherals

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

Storage. Hwansoo Han

Readings. Storage Hierarchy III: I/O System. I/O (Disk) Performance. I/O Device Characteristics. often boring, but still quite important

Chapter 6. Storage & Other I/O

CSCI-GA Operating Systems I/O. Hubertus Franke

Unit 3 and Unit 4: Chapter 4 INPUT/OUTPUT ORGANIZATION

Chapter 6. Storage and Other I/O Topics

Computer Architecture Computer Science & Engineering. Chapter 6. Storage and Other I/O Topics BK TP.HCM

Storage systems. Computer Systems Architecture CMSC 411 Unit 6 Storage Systems. (Hard) Disks. Disk and Tape Technologies. Disks (cont.

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

I/O CANNOT BE IGNORED

Introduction To Computer Hardware. Hafijur Rahman

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Organisasi Sistem Komputer

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

CMSC 313 Lecture 26 DigSim Assignment 3 Cache Memory Virtual Memory + Cache Memory I/O Architecture

Interconnecting Components

Chapter 6. Storage and Other I/O Topics. ICE3003: Computer Architecture Fall 2012 Euiseong Seo

I/O CANNOT BE IGNORED

CS252 S05. CMSC 411 Computer Systems Architecture Lecture 18 Storage Systems 2. I/O performance measures. I/O performance measures

Input/Output. 198:231 Introduction to Computer Organization Lecture 15. Instructor: Nicole Hynes

Digital System Design

Chapter 6. Storage and Other I/O Topics. Jiang Jiang

Input/Output Introduction

Introduction. Motivation Performance metrics Processor interface issues Buses

Announcement. Computer Architecture (CSC-3501) Lecture 23 (17 April 2008) Chapter 7 Objectives. 7.1 Introduction. 7.2 I/O and Performance

CS152 Computer Architecture and Engineering Lecture 19: I/O Systems

Where We Are in This Course Right Now. ECE 152 Introduction to Computer Architecture Input/Output (I/O) Copyright 2011 Daniel J. Sorin Duke University

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

Computer Hardware 2. Type of Computers. User Point of View. The Motherboard. Inside. Content

Computer Organization

Example Networks on chip Freescale: MPC Telematics chip

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

ECE 250 / CPS 250 Computer Architecture. Input/Output

EE 4683/5683: COMPUTER ARCHITECTURE

STANDARD I/O INTERFACES

INPUT-OUTPUT ORGANIZATION

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

Chapter 6. Storage and Other I/O Topics

Computer Science 146. Computer Architecture

L12: I/O Systems. Name: ID:

Answer to exercises chap 13.2

Chapter 5 Input/Output. I/O Devices

Recap: Making address translation practical: TLB. CS152 Computer Architecture and Engineering Lecture 24. Busses (continued) Queueing Theory Disk IO

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

Chapter 8: Input and Output. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V.

ECE 485/585 Microprocessor System Design


Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

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

Chapter 3. Top Level View of Computer Function and Interconnection. Yonsei University

I/O and Device Drivers

Computer Architecture and Organization: L10: I/O Organization

I/O Systems. Jo, Heeseung

This page intentionally left blank

Transcription:

Chapter 8 1 A Typical collection of I/O devices Interrupts Cache I/O bus Main memory I/O controller I/O controller I/O controller Disk Disk Graphics output Network 2 1

Interfacing s and Peripherals I/O Design affected by many factors (expandability, resilience) Performance: access latency throughput connection between devices and the system the memory hierarchy the operating system A variety of different users (e.g., banks, supercomputers, engineers) 3 I/O Devices Very diverse devices behavior (i.e., input vs. output) partner (who is at the other end?) data rate Device Behavior Partner Data rate (Mb/sec) Keyboard input human 0.0001 Mouse input human 0.0038 Voice input input human 0.2630 Scanner input human 3.2 Voice output output human 0.264 Laser printer output human 3.2 Graphics display output human 800-8000 Modem input or output machine 0.016-0.064 Network/LAN input or output machine 100-1000 Optical disk storage machine 80 Magnetic tape storage machine 32 Magnetic disk storage machine 240-2560 4 2

I/O Example: Disk Drives Platters Tracks Platter Sectors Track To access data: seek: position head over the proper track (3 to 14 ms. avg.) rotational latency: wait for desired sector (.5 / RPM) transfer: grab the data (one or more sectors) 30 to 80 MB/sec 5 Buses Buses connect I/O devices to processors and memory A bus is a shared communication link which uses one set of wires to connect multiple systems Advantages Shared link, therefore cost effective Disadvantage Shared link can become a communication bottleneck Each bus has a set of data lines and a set of control lines 6 3

Using a Bus for Input/Output Each bus transaction has two parts Sending the address Receiving/Sending the data Input transaction Inputs data from a device to memory Output transaction Outputting data from memory to a device 7 The three steps of an output transaction Control lines Data lines a. Disks Control lines Data lines b. Disks Control lines Data lines c. Disks 8 4

An input transaction Control lines Data lines a. Disks Control lines Data lines b. Disks 9 Types of buses Backplane bus a. I/O devices -memory bus Bus adapter Bus adapter Bus adapter I/O bus I/O bus I/O bus b. -memory bus Backplane bus Bus adapter Bus adapter Bus adapter I/O bus I/O bus c. 10 5

Types of buses - bus Short High-speed Matched to the memory system I/O buses Lengthy Can have many different devices attached to them Wide range of data transfer speeds Backplane buses Can have processor, memory, I/O devices coexisting on a single bus Balance demands of processor-memory communication with demands of device memory communication 11 Synchronous and Asynchronous Buses Synchronous Driven by a clock Clock input to control lines Protocol for communication is relative to this clock Example: processor-memory communication sends address and read command in first clock cycle sends data on fifth clock cycle Protocol is predetermined and driven by the clock Disadvantage Every device on bus must be able to run at same clock rate Synchronous buses have to be short to avoid clock skew 12 6

Synchronous & Asynchronous Buses Asynchronous Buses Not clocked Can be lengthened Use a handshaking protocol Synchronous buses typically faster than asynchronous 13 Handshaking Protocol for an Asynchronous Bus ReadReq 1 Data 2 2 3 4 6 Ack DataRdy 4 5 7 1. When memory sees ReadReq line, it reads the address from the Data bus and raises ACK to indicate it has been seen 2. I/O device sees ACK and releases ReadReq and Data lines 3. sees ReadReq is low and drops the ACK signal 4. This step starts when memory has the data ready. It places data on the Data line and raises DataRdy 5. I/O device sees DataRdy, reads the data, and then raises ACK 6. The memory sees ACK, and drops DataRdy and releases the data lines 7. I/O device sees DataRdy go low and drops the ACK line 14 7

Obtaining Access to the Bus How is the bus reserved by one of the devices that wants to use it to communicate? Single Bus Master: the CPU Advantage: simple Disadvantage: processor involved in every bus transaction Multiple bus masters Need Bus Arbitration: daisy chain arbitration (not very fair) centralized arbitration (requires an arbiter), e.g., PCI self selection, e.g., NuBus used in old Macintosh collision detection, e.g., Ethernet 15 I/O Bus Standards Today we have two dominant bus standards: 16 8

Buses and Networks of the Pentium 4 I/O Options Pentium 4 processor Main memory DIMMs Disk DDR 400 (3.2 GB/sec) DDR 400 (3.2 GB/sec) Serial ATA (150 MB/sec) controller hub (north bridge) 82875P System bus (800 MHz, 604 GB/sec) AGP 8X (2.1 GB/sec) CSA (0.266 GB/sec) (266 MB/sec) Parallel ATA (100 MB/sec) Graphics output 1 Gbit Ethernet CD/DVD Disk Serial ATA (150 MB/sec) AC/97 (1 MB/sec) Stereo (surroundsound) USB 2.0 (60 MB/sec) I/O controller hub (south bridge) 82801EB Parallel ATA (100 MB/sec) (20 MB/sec) Tape 10/100 Mbit Ethernet... PCI bus (132 MB/sec) 17 Interfacing I/O devices to the,, 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? 18 9

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 19 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 20 10

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 -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 21 Communication with the 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 22 11

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% 23 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%!!!! 24 12

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% 25 Transferring data between device and memory Two methods Interrupt-driven I/O is involved in data transfer Problem: 100% overhead in the case of the hard disk example Direct Access (DMA) Data is transferred directly from the device to memory (or vice versa) is involved only in 1. Initiating the DMA transfer 2. Handling interrupt at the end of DMA transfer 26 13

DMA Implemented with special controller that transfers data between memory and I/O device independent of the processor Three steps in DMA transfers 1. 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 27 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 % 28 14