Adapted from Computer Organization and Design, Patterson & Hennessy, UCB
ECE232: Hardware Organization and Design
Lecture 29: Computer Input/Output
ECE232: Hardware Organization and Design Lecture 29: Computer - - PowerPoint PPT Presentation
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
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB
ECE232: Hardware Organization and Design
Lecture 29: Computer Input/Output
ECE232: Computer I/O 2
Announcements
ECE232: Computer I/O 3
Overview
ECE232: Computer I/O 4
Anatomy: 5 components of any Computer
Memory Devices Input Output Keyboard, Mouse Display, Printer Disk Processor Control Datapath
Processor Cache Memory - I/O Bus Main Memory I/O Controller Disk Disk I/O Controller I/O Controller Graphics Network
interrupts
ECE232: Computer I/O 5
Handling IO
unpredictable times
ECE232: Computer I/O 6
I/O Device Examples and Speeds
(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 7
Parallel ATA (100 MB/sec) Parallel ATA (100 MB/sec) (20 MB/sec) PCI bus (132 MB/sec) CSA (0.266 GB/sec) AGP 8X (2.1 GB/sec) Serial ATA (150 MB/sec) Disk Pentium 4 processor 1 Gbit Ethernet Memory controller hub (north bridge) 82875P Main memory DIMMs DDR 400 (3.2 GB/sec) DDR 400 (3.2 GB/sec) Serial ATA (150 MB/sec) Disk AC/97 (1 MB/sec) Stereo (surround- sound) USB 2.0 (60 MB/sec) . . . I/O controller hub (south bridge) 82801EB Graphics
(266 MB/sec) System bus (800 MHz, 604 GB/sec) CD/DVD Tape 10/100 Mbit Ethernet
Hardware Solution (875 Chipset)
ECE232: Computer I/O 8
Disk Device Terminology
both surfaces (usually)
(e.g., 512 Bytes)
(“seek”), select surface, wait for sector rotate under head, then read or write
Platter Outer Track Inner Track Sector Head Arm Actuator
ECE232: Computer I/O 9
Disk Device Performance
+ Controller Overhead
total #
from head
(bit density), size of request
ECE232: Computer I/O 10
Disk Performance Model /Trends
yrs)
ECE232: Computer I/O 11
Disk Performance
advertised performance; sector is on outer track
+ 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 12
Instruction Set Architecture for I/O
stores for output
space dedicated to communication paths to Input or Output devices (no memory there)
regular memory, instead, they correspond to registers in I/O devices 0xFFFFFFFF 0xFFFF0000 cmd reg. data reg. address
ECE232: Computer I/O 13
Memory Mapped IO
to be part of the system’s main memory
are translated by memory controller hardware into accesses of hardware device
devices – just map them onto different regions of memory
accessing data structures via the device pointers
Memory mapped I/O makes this feasible without any changes to the way a CPU is programmed
ECE232: Computer I/O 14
Processor-I/O Speed Mismatch
store instructions per second, or 4 million KB/s data rate
processor loads it
processor stores it
ECE232: Computer I/O 15
Processor Checks Status before Acting: Polling
(I/O ready), often called Control Register
Data Register
device to set Ready bit in Control reg to say its OK (0 1)
register
bit (1 0) of Control Register
ECE232: Computer I/O 16
Cost of Polling?
polling operation (call polling routine, accessing the device, and returning). Determine % of processor time for polling
transfer at 8 MB/second. No transfer can be missed
Polling mouse has little impact on processor
= 500K * 400 = 200,000,000 clocks/sec
ECE232: Computer I/O 17
What is the alternative to polling? Interrupt
waiting” for I/O to be ready
be invoked only when I/O device is ready
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 18
I/O Interrupt
additional information
information
resumes
ECE232: Computer I/O 19
Interrupt Driven Data Transfer
(1) I/O interrupt (2) save PC (3) interrupt service addr
Memory
add sub and
user program read store ... jr interrupt service routine (4) (5)
ECE232: Computer I/O 20
Benefit of Interrupt-Driven I/O
is only active 5% of the time
= 500K interrupts/sec
= 250,000,000 clocks/sec
ECE232: Computer I/O 21
Interrupts – Multiple devices
(network, keyboard,..) Processor Advanced Priority Interrupt Controller (APIC) Device 1 Device 2 Device n Device i
ECE232: Computer I/O 22
Interrupt vs. Polling
to do and the time-to-response is not critical
ASAP
intervals such as in a modem
ECE232: Computer I/O 23
Direct Memory Access (DMA)
Memory? Waste of CPU cycles if done through CPU
memory => DMA
transferred
memory address and transfers the data
the CPU to inform completion
stealing cycles from the CPU
ECE232: Computer I/O 24
OS control of I/O operations
requires managing a set of concurrent events and because requirements for correct device control are often very detailed
information about I/O operations and these can occur at a random time
processor
control