1 / 22

CS1104 – Computer Organization http://www.comp.nus.edu.sg/~cs1104

CS1104 – Computer Organization http://www.comp.nus.edu.sg/~cs1104. Aaron Tan Tuck Choy School of Computing National University of Singapore. Lecture 15: I/O Devices and Buses. I /O Devices Anatomy of a Computer Device Examples and Speeds Magnetic Disks Disk Device Terminology

milla
Download Presentation

CS1104 – Computer Organization http://www.comp.nus.edu.sg/~cs1104

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS1104 – Computer Organizationhttp://www.comp.nus.edu.sg/~cs1104 Aaron Tan Tuck Choy School of Computing National University of Singapore

  2. Lecture 15: I/O Devices and Buses • I/O Devices • Anatomy of a Computer • Device Examples and Speeds • Magnetic Disks • Disk Device Terminology • Disk Device Performance • Disk Transfer Data Rate • Synchronizing Processor and I/O Devices • Polling • Cost of Polling • Alternative to Polling • Summary Lecture 15: I/O Devices and Buses

  3. Lecture 15: I/O Devices and Buses • Buses • Introduction • Advantages of Buses • Disadvantages of Buses • General Organization of a Bus • Master versus Slave Lecture 15: I/O Devices and Buses

  4. Keyboard,Mouse Computer Processor (active) Memory (passive) (where programs, data live when running) Devices Disk(where programs, data live when not running) Control (“brain”) Input Datapath (“brawn”) Output Display,Printer I/O: Anatomy of a Computer • Five components. I/O: Anatomy of a Computer

  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 (Kbytes/sec) Keyboard Input Human 0.01 Mouse Input Human 0.02 Line Printer Output Human 1.00 Floppy disk Storage Machine 50.00 Laser Printer Output Human 100.00 Optical Disk Storage Machine 500.00 Magnetic Disk Storage Machine 10,000.00 Network-LAN I or O Machine 10,000.00 Graphics Display Output Human 30,000.00 I/O: Device Examples and Speeds

  6. I/O: Magnetic Disks • Purpose: • Long-term, nonvolatile, inexpensive storage for files • Large, inexpensive, slow level in the memory hierarchy Arm Head Actuator Platters I/O: Magnetic Disks

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

  8. Head Arm Inner Track Outer Track Actuator Sector Platters I/O: Disk Device Performance • Access time = Seek Time + Rotation Time + Transfer Time + Controller Overhead • Seek Time? Depends no. tracks move arm, seek speed of disk • Rotation Time? Depends on speed disk rotates, how far sector is from head • Transfer Time? Depends on data rate (bandwidth) of disk, size of request I/O: Disk Device Performance

  9. I/O: Disk Transfer Data Rate • To keep things simple, originally kept same number of sectors per track • Since outer track longer, lower bits per inch • As competition grew, decided to keep BPI (“constant bit density”) the same for all tracks • More capacity per disk • more of sectors per track towards edge • Since disk spins at constant speed, outer track has faster data rate • 1.5X outer track vs. inner track! I/O: Disk Transfer Data Rate

  10. I/O: Synchronizing Processor and I/O Devices • 500 MHz microprocessor can execute a 500 million load or store instructions per second, or 200,000 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. • Output device may not be ready to accept data as fast as processor stores it . • What to do? I/O: Synchronizing Processor and I/O Devices

  11. I/O: Polling • Processor checks status before acting. • Path to device generally has 2 registers: • 1 register says its OK to read/write (I/O ready), often called Control Register. • 1 register to contain data, often called Data Register. • Processor reads from Control Register in loop, waiting for device to set Ready bit in Control Register to say its OK. • Processor then loads from (input) or writes to (output) data register. • Load from device/Store into Data Register resets Ready bit of Control Register. I/O: Polling

  12. I/O: Cost of Polling • Assume for a processor with a 500-MHz clock, it 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 so as not to miss user movement. • Floppy disk: transfers data in 2-byte units and has a data rate of 50 KB/second. No data transfer can be missed. • “Hard” disk: transfers data in 16-byte chunks and can transfer at 4 MB/second. Again, no transfer can be missed. I/O: Cost of Polling

  13. I/O: Cost of Polling • Mouse Polling Clocks/sec = 30 * 400 = 12000 clocks/sec • % Processor for polling: 12*103/500*106= 0.002%  Polling mouse little impact on processor • Times Polling Floppy/sec = 50 KB/s /2B = 25K polls/sec • Floppy Polling Clocks/sec = 25K * 400 = 10,000,000 clocks/sec • % Processor for polling: 10*106/500*106= 2%  OK if not too many I/O devices I/O: Cost of Polling

  14. I/O: Cost of Polling • Times Polling Disk/sec = 4 MB/s /16B = 250K polls/sec • Disk Polling Clocks/sec = 250K * 400 = 100,000,000 clocks/sec • % Processor for polling: 100*106/500*106= 20%  Unacceptable I/O: Cost of Polling

  15. I/O: Alternative to Polling • Wasteful to have processor spend most of its time “spin-waiting” 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. • Interrupt program when I/O ready, return when done with data transfer. I/O: Alternative to Polling

  16. I/O: Summary • I/O gives computers their 5 senses. • I/O speed range is million to one. • Processor speed means must synchronize with I/O devices before use. • Polling works, but expensive. • Interrupts works, but more complex. I/O: Summary

  17. Processor Input Control Memory Datapath Output Bus: Introduction • Transit Link bus? • A bunch of wires... • Shared communication link. • Single set of wires used to connect multiple subsystems. • A bus is also a fundamental tool for composing large, complex systems. Bus: Introduction

  18. I/O Device I/O Device I/O Device Processor Memory Bus: Advantages of Buses • Versatility: • New devices can be added easily • Peripherals can be moved between computersystems that use the same bus standard • Low Cost: • A single set of wires is shared in multiple ways • Manage complexity by partitioning the design Bus: Advantages of Buses

  19. Bus: Disadvantages of Buses • It creates a communication bottleneck • The bandwidth of that bus can limit the maximum I/O throughput • The maximum bus speed is largely limited by: • The width of the bus • The numberof devices on the bus • The need to support a range of devices with: • Widely varying latencies • Widely varying data transfer rates Bus: Disadvantages of Buses

  20. Control Lines Data Lines Bus: General Organization of a Bus • Control lines: • Signal requests and acknowledgments • Indicate what type of information is on the data lines • Data linescarry information between the source and the destination: • Data and Addresses Bus: General Organization of a Bus

  21. Master issues command Bus Master Bus Slave Data can go either way Bus: Master versus Slave • A bus transaction includes two parts: • Issuing the command (and address) – request • Transferring the data – action • Master is the one who starts the bus transaction by: • issuing the command (and address) • Slave is the one who responds to the address by: • Sending data to the master if the master ask for data • Receiving data from the master if the master wants to send data Bus: Master versus Slave

  22. End of segment

More Related