ECE232: Hardware Organization and Design

Similar documents
ECE331: Hardware Organization and Design

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.

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

Lecture 13. Storage, Network and Other Peripherals

Review. Motivation for Input/Output. What do we need to make I/O work?

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

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

Module 6: INPUT - OUTPUT (I/O)

Virtual Memory Input/Output. Admin

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

INPUT/OUTPUT DEVICES Dr. Bill Yi Santa Clara University

ECE331: Hardware Organization and Design

CS 61C: Great Ideas in Computer Architecture. Input/Output

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 36: IO Basics

Systems Architecture II

CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 36: IO Basics. Instructor: Dan Garcia h<p://inst.eecs.berkeley.

61C In the News. Review. Memory Management Today. Impact of Paging on AMAT

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)

Computer Science 61C Spring Friedland and Weaver. Input/Output

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

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

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

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

Chapter 6. Storage & Other I/O

UNIT 2 Data Center Environment

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568

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

CS61C : Machine Structures

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

CSE 153 Design of Operating Systems Fall 2018

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

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Computer System Overview

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568

Introduction to Input and Output

Lecture 23. Finish-up buses Storage

EN1640: Design of Computing Systems Topic 07: I/O

Review. Manage memory to disk? Treat as cache. Lecture #26 Virtual Memory II & I/O Intro

ECE232: Hardware Organization and Design

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

Where Have We Been? Ch. 6 Memory Technology

CSE 153 Design of Operating Systems

Computer Architecture CS 355 Busses & I/O System

Storage Systems. Storage Systems

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2002

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

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS61C - Machine Structures. Week 7 - Disks. October 10, 2003 John Wawrzynek

High-Performance Storage Systems

I/O CANNOT BE IGNORED

Introduction To Computer Hardware. Hafijur Rahman

I/O Systems. Jo, Heeseung

Recap: Machine Organization

Chapter Seven Morgan Kaufmann Publishers

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

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-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

FUNCTIONS OF COMPONENTS OF A PERSONAL COMPUTER

Lectures More I/O

UCB CS61C : Machine Structures

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

Motivation for Input/Output

Virtual Memory - Objectives

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

CS510 Operating System Foundations. Jonathan Walpole

Adapted from instructor s supplementary material from Computer. Patterson & Hennessy, 2008, MK]

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

COSC121: Computer Systems. Exceptions and Interrupts

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

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

Computer Systems Laboratory Sungkyunkwan University

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

Devices and Device Controllers. secondary storage (disks, tape) and storage controllers

Bus Architecture Example

Virtual Memory. Reading. Sections 5.4, 5.5, 5.6, 5.8, 5.10 (2) Lecture notes from MKP and S. Yalamanchili

CMSC 611: Advanced Computer Architecture

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

I/O CANNOT BE IGNORED

ECE 3055: Final Exam

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

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

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

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

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Storage System COSC UCB

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568

Example Networks on chip Freescale: MPC Telematics chip

Introduction to I/O. April 30, Howard Huang 1

CSE 380 Computer Operating Systems

QUIZ Ch.6. The EAT for a two-level memory is given by:

Organisasi Sistem Komputer

ECE468 Computer Organization and Architecture. OS s Responsibilities

I/O Management Intro. Chapter 5

Thomas Polzer Institut für Technische Informatik

Transcription:

ECE232: Hardware Organization and Design Lecture 29: Computer Input/Output Adapted from Computer Organization and Design, Patterson & Hennessy, UCB

Announcements ECE Honors Exhibition Wednesday, April 30 3:00-4:00 PM M5 SDP Demo Day 10AM-2PM, Friday, April 25 Gunness Student Center ECE Picnic (tickets in ECE office/eliza) 3-7PM, Friday, April 25 Hadley Young Men s Club ECE Banquet (tickets in ECE office/eliza) 6-9PM, Friday, May 2 Courtyard Marriott, Hadley ECE232: Computer I/O 2

Overview Input and output are fundamental for computer operation Typically much slower than computation Two types of transfer Polling processor constantly checks for data Interrupts processor is interrupted from activity Need to understand the requirements of data transfer Tied to computer organization (bus, interfaces, etc) I/O bandwidth is important (how fast, how much) Most interfaces today are standardized (USB, monitor, Ethernet) ECE232: Computer I/O 3

Anatomy: 5 components of any Computer Processor Processor Control Datapath Memory Devices Input Output Keyboard, Mouse Disk Display, Printer Cache interrupts Memory - I/O Bus Main Memory I/O Controller I/O Controller I/O Controller Disk Disk Graphics Network ECE232: Computer I/O 4

Handling IO Users like to connect devices to their computers Keyboard, mouse, printer External devices may require attention from processor at unpredictable times CPU doesn t know when you re about to hit a key IO devices can be very fast or very slow Need to have a flexible way to control all devices ECE232: Computer I/O 5

I/O Device Examples and Speeds I/O Speed: bytes transferred per second (from mouse to display: million-to-1) Device Behavior Partner Data Rate (Mbit/sec) Keyboard Input Human 0.0001 Mouse Input Human 0.0038 Laser Printer Output Human 3.2000 Magnetic Disk Storage Machine 240-2560 Modem I or O Machine 0.016-0.064 Network-LAN I or O Machine 100-1000 Graphics Display Output Human 800-8000 ECE232: Computer I/O 6

Hardware Solution (875 Chipset) Pentium 4 processor Main memory DIMMs DDR 400 (3.2 G B/sec) DDR 400 (3.2 G B/sec) Memory controller hub (north bridge) 82875P System bus (800 MHz, 604 GB/sec) AGP 8X (2.1 G B/sec) CSA (0.266 GB/sec) Graphics output 1 Gbit Ethernet Disk Serial ATA (150 MB/sec) (266 M B/sec) Parallel ATA (100 MB/sec) 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 M B/sec) (20 MB/sec) Tape 10/100 M bit Ethernet... PCI bus (132 M B/sec) ECE232: Computer I/O 7

Disk Device Terminology Several platters, with information recorded magnetically on both surfaces (usually) Arm Head Sector Inner Track Outer Track Actuator Platter Bits recorded in tracks, which in turn are divided into sectors (e.g., 512 Bytes) Actuator moves head (end of arm, 1/surface) over track ( seek ), select surface, wait for sector rotate under head, then read or write Cylinder : all tracks under heads ECE232: Computer I/O 8

Disk Device Performance Disk Latency = Seek Time + Rotation Time + Transfer Time + Controller Overhead Seek Time - depends on no. tracks arm moves, seek speed Average no. tracks arm moves? Sum all possible seek distances from all possible tracks / total # Assumes average seek distance is random Disk industry standard benchmark Rotation Time - depends on rotation speed, how far sector is from head 1/2 time of a rotation Example: 7200 Revolutions Per Minute 120 Rev/sec 1 revolution = 1/120 sec 8.33 milliseconds 1/2 rotation (revolution) 4.16 ms Transfer Time - depends on data rate (bandwidth) of disk (bit density), size of request ECE232: Computer I/O 9

Disk Performance Model /Trends Capacity + 100%/year (2X/1 yr) Transfer rate (BW) + 40%/year (2X/2 yrs) Rotation + Seek time 8%/year (1/2 in 10 yrs) MB/$ > 100%/yr (2X/<1.5 yr) ECE232: Computer I/O 10

Disk Performance Calculate time to read 1 sector (512B) for UltraStar 72 using advertised performance; sector is on outer track Disk latency = average seek time + average rotational delay + transfer time + controller overhead = 5.3 ms + 0.5 * 1/(10000 RPM) + 0.5 KB / (50 MB/s) + 0.15 ms = 5.3 + 3.0 + 0.01 + 0.15 ms = 8.46 ms ECE232: Computer I/O 11

Instruction Set Architecture for I/O Some machines have special input and output instructions Alternative model (used by MIPS): Input: ~ reads a sequence of bytes Output: ~ writes a sequence of bytes Memory also a sequence of bytes, so use loads for input, stores for output Called Memory Mapped Input/Output A portion of the address space dedicated to communication paths to Input or Output devices (no memory there) These addresses are not regular memory, instead, they correspond to registers in I/O devices address 0 0xFFFF0000 0xFFFFFFFF cmd reg. data reg. ECE232: Computer I/O 12

Memory Mapped IO Make control registers and I/O device data registers appear to be part of the system s main memory Reads and writes to the mapped region of the memory are translated by memory controller hardware into accesses of hardware device Makes it easy to support variable numbers/types of devices just map them onto different regions of memory Accessing I/O device registers and memory can be done by accessing data structures via the device pointers Most device drivers are now written in C/C++. Memory mapped I/O makes this feasible without any changes to the way a CPU is programmed ECE232: Computer I/O 13

Processor-I/O Speed Mismatch 1 GHz microprocessor can execute 1000 million load or store instructions per second, or 4 million KB/s data rate I/O devices from 0.01 KB/s to 30,000 KB/s Input: device may not be ready to send data as fast as the processor loads it Also, might be waiting for human to act Output: device may not be ready to accept data as fast as processor stores it What to do? ECE232: Computer I/O 14

Processor Checks Status before Acting: Polling Path to device generally has 2 registers: 1 register says it s OK to read/write (I/O ready), often called Control Register 1 register that contains data, often called Data Register Processor reads from Control Register in loop, waiting for device to set Ready bit in Control reg to say its OK (0 1) Processor then loads from (input) or writes to (output) data register Load from device/store into Data Register resets Ready bit (1 0) of Control Register ECE232: Computer I/O 15

Cost of Polling? Assume: a 1 GHz processor takes 400 clock cycles for a polling operation (call polling routine, accessing the device, and returning). Determine % of processor time for polling Mouse: polled 30 times/sec - not to miss user movement Hard disk: transfers data in 16-byte chunks and can transfer at 8 MB/second. No transfer can be missed Mouse Polling Clocks/sec = 30 * 400 = 12000 clocks/sec % Processor for polling = 12*10 3 /1*10 9 = 0.0012% Polling mouse has little impact on processor Times Polling Disk/sec = 8 MB/s /16B = 500K polls/sec Disk Polling Clocks/sec = 500K * 400 = 200,000,000 clocks/sec % Processor for polling: 2*10 8 /1*10 9 = 20% Unacceptable ECE232: Computer I/O 16

What is the alternative to polling? Interrupt Wasteful to have processor spend most of its time spinwaiting for I/O to be ready Wish we could have an unplanned procedure call that would be invoked only when I/O device is ready Solution: use exception mechanism to help I/O. Interrupt program when I/O ready, return when done with data transfer Polling is like picking up the phone every few seconds to see if you have a call. Interrupt is like letting the phone ring ECE232: Computer I/O 17

I/O Interrupt Controller sends interrupt to the processor along with additional information which device nature of interrupt: error, no paper, no ink, Processor halts execution of current program Saves State Processor looks up which handler to start from the interrupt information When interrupt is handled, returns to program state and resumes ECE232: Computer I/O 18

Interrupt Driven Data Transfer Memory (1) I/O interrupt add sub and user program (2) save PC or (3) interrupt service addr (4) read store (5)... jr interrupt service routine ECE232: Computer I/O 19

Benefit of Interrupt-Driven I/O 500 clock cycle overhead for each transfer, including interrupt. Find the % of processor consumed if the hard disk is only active 5% of the time If interrupt rate = polling rate Disk Interrupts/sec = 8 MB/s /16B = 500K interrupts/sec Disk Polling Clocks/sec = 500K * 500 = 250,000,000 clocks/sec % Processor used during transfers: 250*10 6 /1*10 9 = 25% If disk active 5% 5% * 25% 1.25% busy ECE232: Computer I/O 20

Interrupts Multiple devices Aggregates interrupts Prioritization (network, keyboard,..) Device 1 Processor Advanced Priority Interrupt Controller (APIC) Device 2 Device i Device n ECE232: Computer I/O 21

Interrupt vs. Polling Which is better: Interrupts or Polling? Interrupts are better if the processor has something else to do and the time-to-response is not critical Polling is better if the processor has to respond to an event ASAP Polling is also used when data is expected at regular intervals such as in a modem Modem typically connects to a com port The com port can be polled at expected intervals ECE232: Computer I/O 22

Direct Memory Access (DMA) How to transfer large amounts of data between a Device and Memory? Waste of CPU cycles if done through CPU Let the device controller transfer data directly to and from memory => DMA The CPU sets up the DMA transfer by supplying the type of operation, memory address and number of bytes to be transferred The DMA controller contacts the bus directly, provides memory address and transfers the data Once the DMA transfer is complete, the controller interrupts the CPU to inform completion Cycle Stealing Bus gives priority to DMA controller thus stealing cycles from the CPU ECE232: Computer I/O 23

OS control of I/O operations Low-level control of I/O device is complex because it requires managing a set of concurrent events and because requirements for correct device control are often very detailed I/O systems often use interrupts to communicate information about I/O operations and these can occur at a random time The I/O system is shared by multiple programs using the processor Would like I/O services for all user programs under safe control ECE232: Computer I/O 24