Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS1104 – Computer Organization

Similar presentations

Presentation on theme: "CS1104 – Computer Organization"— Presentation transcript:

1 CS1104 – Computer Organization
Aaron Tan Tuck Choy School of Computing National University of Singapore

2 Lecture 15: I/O Devices and Buses
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 CS Lecture 15: I/O Devices and Buses

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

4 I/O: Anatomy of a Computer
Five components. Disk (where programs, data live when not running) Processor (active) Computer Control (“brain”) Datapath (“brawn”) Memory (passive) (where data live when running) Devices Input Output Keyboard, Mouse Display, Printer CS 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 Optical Disk Storage Machine Magnetic Disk Storage Machine 10,000.00 Network-LAN I or O Machine 10,000.00 Graphics Display Output Human 30,000.00 CS 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 CS I/O: Magnetic Disks

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

8 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 Platters Outer Track Inner Sector Actuator Head Arm CS 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! CS 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? CS 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. CS 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. CS I/O: Cost of Polling

13 I/O: Cost of Polling Mouse Polling Clocks/sec = 30 * = 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 * = 10,000,000 clocks/sec % Processor for polling: 10*106/500*106 = 2%  OK if not too many I/O devices CS 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 * = 100,000,000 clocks/sec % Processor for polling: 100*106/500*106 = 20%  Unacceptable CS 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. CS 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. CS I/O: Summary

17 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. Control Datapath Memory Processor Input Output CS Bus: Introduction

18 Bus: Advantages of Buses
Memory Processor I/O Device Versatility: New devices can be added easily Peripherals can be moved between computer systems that use the same bus standard Low Cost: A single set of wires is shared in multiple ways Manage complexity by partitioning the design CS 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 number of devices on the bus The need to support a range of devices with: Widely varying latencies Widely varying data transfer rates CS Bus: Disadvantages of Buses

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

21 Bus: Master versus Slave
Master issues command Data can go either way 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 CS Bus: Master versus Slave

22 End of segment

Download ppt "CS1104 – Computer Organization"

Similar presentations

Ads by Google