View
224
Download
1
Tags:
Embed Size (px)
Citation preview
21998 Morgan Kaufmann Publishers
Interfacing Processors 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)each has different requirements.
31998 Morgan Kaufmann Publishers
Typical Collection of I/O Devices
Mainmemory
I/Ocontroller
I/Ocontroller
I/Ocontroller
Disk Graphicsoutput
Network
Memory– I/O bus
Processor
Cache
Interrupts
Disk
41998 Morgan Kaufmann Publishers
Importance of I/O in a Networked Society
• Processors are being built from the same basic technology.
• I/O becomes one of the most distinctive features of the machines.
• As the importance of networking and information infrastructure grows, I/O plays an increasing important role.
51998 Morgan Kaufmann Publishers
Impact of I/O on System Performance
• Suppose we have a benchmark that executes in 100 seconds of elapse time, where 90 seconds is CPU time and the rest is I/O time. If the CPU improves by 50% per year for the next five years but I/O time doesn’t improve, how much faster will our program run at the end of five years?
Amdahl’s Law again!
61998 Morgan Kaufmann Publishers
I/O
• Important but neglected
“The difficulties in assessing and designing I/O systems haveoften relegated I/O to second class status”
“courses in every aspect of computing, from programming tocomputer architecture often ignore I/O or give it scanty coverage”
“textbooks leave the subject to near the end, making it easierfor students and instructors to skip it!”
• GUILTY!
— we won’t be looking at I/O in much detail
— be sure and read Chapter 8 in its entirety.
— you should probably take a networking class!
71998 Morgan Kaufmann Publishers
Assessing I/O Performance
• Depends on the application
• System throughput
• I/O bandwidth
– how much data can we move through the system in a certain time?
– How many I/O operations can we do per unit of time?
• Response time
81998 Morgan Kaufmann Publishers
I/O Performance Measures
• Examples from Disk and File Systems• affected by disk technology, how disk are connected, the memory, the processor, a
nd the file system provided by the OS.• Benchmark relatively primitive compared with those for the CPU.• Note: transfer rate: 1 MB = 10^6 bytes, not 2^20 bytes• Supercomputer I/O benchmarks: dominated by access to large files on magnetic di
sks. Data throughput, # of bytes per second that can be transferred between a supercomputer’s main memory and disks.
• Transaction Processing(TP) I/O benchmarks: – involve both response time requirement and a performance based on throughp
ut. – Concerned with I/O rate, measured as # of disk accesses per second.– TPC has developed several benchmarks.
• File System I/O benchmarks: five phases --> Makedir, Copy, ScanDir, ReadAll, Make
91998 Morgan Kaufmann Publishers
I/O Devices
• Very diverse devices— behavior (i.e., input vs. output)— partner (who is at the other end?)— data rate: peak rate at which data can be transferred
Device Behavior Partner Data rate (KB/sec)Keyboard input human 0.01Mouse input human 0.02Voice input input human 0.02Scanner input human 400.00Voice output output human 0.60Line printer output human 1.00Laser printer output human 200.00Graphics display output human 60,000.00Modem input or output machine 2.00-8.00Network/LAN input or output machine 500.00-6000.00Floppy disk storage machine 100.00Optical disk storage machine 1000.00Magnetic tape storage machine 2000.00Magnetic disk storage machine 2000.00-10,000.00
101998 Morgan Kaufmann Publishers
Magnetic Disks
• Disk storage is nonvolatile, meaning that the data remains even when power is removed.
• Platters in hard disk are metal (or glass), offering several advantages over floppy disks:
– can be larger because it is rigid
– has higher density because it can be controlled more precisely
– Has a higher data rate because it spins faster
– can incorporate more platter
111998 Morgan Kaufmann Publishers
I/O Example: Disk Drives
• To access data:— seek: position head over the proper track (8 to 20 ms. avg.)— rotational latency: wait for desired sector (.5 / RPM)— transfer: grab the data (one or more sectors) 2 to 15 MB/sec
Platter
Track
Platters
Sectors
Tracks
121998 Morgan Kaufmann Publishers
Example
• For a disk rotating at 3600 RPM,
average rotational latency = 0.5 rotation / 3600 RPM = 0.5 rotation/(3600 RPM/ 60) = 8.3ms
• For a disk rotating at 7200 RPM, average rotational latency = 4.2ms
• Note: detailed control of the disk and the transfer between the disk and the memory is usually handled by a disk controller. The controller adds the final component of disk access time, controller time.
• The average time to perform an I/O operation will consist of these four times plus any wait time incurred because other processes are using the disk.
• Many recent disks have included caches directly in the disk to speed up the access time.
131998 Morgan Kaufmann Publishers
Disk Read Time
• What is the average time to read or write a 512-byte sector for a typical disk rotating at 5400 RPM? The advertised average seek time is 12 ms, the transfer rate is 5MB/sec, and the control overhead is 2ms. (Assuming no waiting time)
141998 Morgan Kaufmann Publishers
Networks
• Key characteristics of typical networks:
– distance: 0.01 to 10,000 kilometers
– speed: 0.001 MB/sec to 1GBit/sec
– topology: bus, ring, star, tree
– shared lines: none (point-to-point) or shared
• RS232: slow but cheap
• LAN (ethernet): up to 1GBit/sec
• Ethernet is a bus with multiple masters and a scheme for determining who gets bus control.
• ATM: scalable network technology (155 Mbits/sec to 2.5 Gbits/sec)
• Example: Performance of two networks( p.654 of text)
151998 Morgan Kaufmann Publishers
I/O Example: Buses
• Shared communication link (one or more wires)
• Difficult design:— may be bottleneck— length of the bus— number of devices— tradeoffs (buffers for higher bandwidth increases latency)— support for many different devices— cost
• Types of buses:— processor-memory (short high speed, custom design)— backplane (high speed, often standardized, e.g., PCI)— I/O (lengthy, different devices, standardized, e.g., SCSI)
161998 Morgan Kaufmann Publishers
Bus: Connecting I/O Devices to Processor and Memory
• A bus generally contains a set of control lines and a set of data lines.
• Control lines are used to signal requests and acknowledges, and to indicate what type of information is on the data lines
• Data lines carry information between the source and the destination. The information may consist of data, complex commands or addresses.
• Bus transaction includes two parts: sending the address and receiving or sending the data.
• Read transaction == input to memory so the processor can read it
• Write transaction == output to device from memory
171998 Morgan Kaufmann Publishers
Output Operation
Memory Processor
Control lines
Data lines
Disks
Memory Processor
Control lines
Data lines
Disks
Processor
Control lines
Data lines
Disks
a.
b.
c.
Memory
181998 Morgan Kaufmann Publishers
Synchronous and Asynchronous Buses
• Synchronous buses
– use a clock and a synchronous protocol, fast and small
– but every device must operate at same rate
– clock skew requires the bus to be short
– processor-memory buses are often synchronous
• Asynchronous buses
– don’t use a clock and instead use handshaking
– can accommodate a wide variety of devices
191998 Morgan Kaufmann Publishers
Asynchronous Protocol
• Let’s look at some examples from the text
“Performance Analysis of Synchronous vs. Asynchronous”“Performance Analysis of Two Bus Schemes”
DataRdy
Ack
Data
ReadReq 13
4
57
642 2
201998 Morgan Kaufmann Publishers
Increasing Bus Bandwidth
• Data bus width
• Separate versus multiplexed address and data lines
• Block transfers
211998 Morgan Kaufmann Publishers
Bus Arbitration
• daisy chain arbitration (not very fair)
• centralized arbitration (requires an arbiter), e.g., PCI
• self selection, e.g., NuBus used in Macintosh
• collision detection, e.g., Ethernet
221998 Morgan Kaufmann Publishers
Bus Standards
• PCI ( a general purpose backplane bus)
• SCSI (Small Computer System Interface)
• IEEE 1394 (Firewire)
• USB 2.0
231998 Morgan Kaufmann Publishers
Interfacing I/O Devices
• Operating system:
— polling
— interrupts
— DMA
241998 Morgan Kaufmann Publishers
Overhead of Polling
• Example 1: mouse
• Example 2: floppy disk
• Example 3: hard disk
• What if we use a interrupt-driven I/O?
• How about DMA?