27
IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Embed Size (px)

Citation preview

Page 1: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

IT253: Computer Organization

Lecture 13:Input/Output

Tonga Institute of Higher Education

Page 2: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Input/Output

• Input and output allows people to work with computers.

• It includes many parts: keyboard, mouse, printer, hard drive, network card…

Page 3: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

I/O Examples

Page 4: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Storage Devices• The hard disk is an I/O device.• It is long-term storage that is a slow, but

still a valuable part of the memory hierarchy

Page 5: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Organization of Magnetic Disk

• Most of the time, a hard disk will have:– 500-2000 tracks per platter– 32 – 128 sectors per track (a sector is the smallest

amount of data that can be read or written)– Usually all tracks have same number of sectors,

but sometimes they are different because it might be faster to get to one spot on the hard disk than another

Page 6: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Characteristics of Magnetic Disks

• Cylinder – the word for all the tracks that can be read by the read/write head in the spot that the read/write head is in

• Reading and Writing data takes 3 steps– Seek time – move the head to the correct

place– Rotational latency – wait for the platter to

spin so that the right sector is underneath the head

– Transfer time – time it takes to transfer a sector from the head

Page 7: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Characteristics of Magnetic Disks

• Rotational Latency – Most disks rotate at 3,600 RPM to 10K RPM

(rotations per minute). About 3.5 ms to 16 ms for one rotation

• Transfer time depends on:– Transfer size (usually 1 KB sectors)– Rotation speed– Recording density (how many bits you can fit in one

square inch)– Diameter of the platter– Usually you can get 2 – 12 MB of data transferred a

second

Page 8: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Disk Access

• Access time = queue + seek + rotational + transfer + overhead– Queue – the request has to wait for other

things to finish first– Seek time – move arm of head over track– Rotational latency – wait for platter to

spin to right place– Transfer time – the number of bits you get

a second

Page 9: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Disk Access Example• Parameters:

– Transfer size: 8MB– Advertised average seek is 12 ms– Disk spins at 7200 RPM– Transfer rate is 4 MB– Average rotational delay: 4 ms– Controller overhead: 2 ms

• What is average disk access time for a sector?– Avg seek + avg rotate delay + transfer time + overhead– 12 ms + 4 + 8 MB/4 MB/s + 2 ms– 12 + 4 + 2 + 2 = 20 ms

• Advertised rate was 12 ms, but really 20 ms. The real rate is usually about only ¼ as fast as the advertised rate.

Page 10: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Alternative Storage

• DRAM as hard disk – you could use DRAM as your hard disk, but you would need the power to be on all the time, and it would be expensive, but very fast

• CD-ROM – read only• CD-RW – read and write• Magnetic tape –

– Sequential access, very slow, very big in size. Tera or peta bytes of data

Page 11: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Buses: Connecting I/O to Processor

• A bus is a communication link between devices• It is usually a set of wires that will connect to

many things all at once (between different inputs and outputs and the processor and memory)

Page 12: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Goods things about Buses

• Why do we need buses?– Allows us to add new devices easily– Allows us to move parts from one computer to

another if they use same bus type– Lower cost because we only use one set of

wires to connect all the pieces

Page 13: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Bad things about buses

• Buses can also introduce a few problems for computers– They create a communication bottleneck. – Things may not be able to send and get data

as fast as possible because it has to wait for other things to use the bus

• Maximum speed of a bus is determined by:– Length of bus– How many devices are on the bus– How many devices it has to work with

(different devices will have different speeds for sending and getting data

Page 14: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Bus Organization• A bus will have two wires, one for control of the

bus and one for sending data– Control Lines:

• Carries requests and acknowledgements for who wants to use the bus

• Tells what kind of data is being sent on the bus

– Data Lines:• Carries data between source and destination

Page 15: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Master/Slave Bus Organization

• To use the bus, two things must happen:– Sending the address– Receiving or sending data

• A Master device will start the transaction on the bus by sending the address

• A Slave device will respond to this address by either– Sending data to the master– Receiving data from master

Page 16: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Outputting DataThere are three steps for outputting data

1. A request on the bus to read memory2. Reading the memory3. Sending the memory to the output device

Page 17: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Input Operation• Input is when the processor receives data

from an input device• When we want to do an input operation we

need to take two steps.– A request to write memory on the bus– Sending data from input device to memory

Page 18: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Types of buses• There are different types of buses that a

computer can use to transfer data between different objects– Processor-Memory bus: short and high speed.

Connected directly from memory to processor– External I/O bus: longer and slow. Must work

with many devices. Connects to processor memory bus

– Backplane bus: connects all the pieces together, including memory and processor and all I/O devices. Only one bus needed

– Bit-Serial Bus: high speed buses that connect directly from one object to another object. (like USB or FireWire)

Page 19: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

A Backplane Bus Computer

• Backplane bus: a single bus is used to connect all components– Simple and low cost– But it is slow and can cause bottlenecks

where data waits for a long time before it gets where it needs to go.

– Not used today

Page 20: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Two-Bus Computer• A two-bus computer will use an I/O bus for the

devices and a processor-memory bus• I/O buses connect to the processor-memory bus

through “bus adapters”• The bus adapters allow the different buses to work

together without problems

Page 21: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Synchronous and Asynchronous Buses

• Synchronous bus: this means that the operation of the bus is determined by a clock cycle– It is pretty easy to implement and also runs fast– But every device on the bus must use same clock cycle

and if the bus is too long there will be “clock skew”– Clock skew is a problem where a device at the end of

the bus may think it’s an older clock cycle, but a new cycle has already started

• Asynchronous bus: – No cycle and can work with many devices– It can be any size without worrying about clock skew– Not as fast.

Page 22: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Using the bus• One of the most important issues is how will devices

get access to control the bus• The master-slave system avoids many of the

problems. The bus master controls all actions and tells devices when they will read data and when they will write data to the bus

• The simplest way is to make the processor the bus master. That means every time there is an I/O transaction the processor has to be told about it and then tell the bus to do that. This means the processor is slowed down by bus transactions

Page 23: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Bus Masters

• It is not the best solution to use the processor as the bus master.

• Instead, we might have a few pieces of hardware act as the bus masters.

• That means there needs to be a way to determine who will use the bus if there are many masters

• This is called bus arbitration and it uses two ideas– Priority – if something is really important, then it should

be allowed to use the bus right away– Fairness – make sure all the devices are able to use the

bus in a reasonable amount of time

Page 24: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Bus Arbitration• There are generally four bus arbitration ideas used

– Distributed arbitration by self-selection - each device on the bus will put a request on the bus to use it when it needs it. It then might have to wait its turn

– Distributed arbitration by collision detection – this is what Ethernet uses. It will just send the data on the bus and if it crashes into other data and is lost, then it will send again

– Daisy Chain arbitration – there is one device which is a bus arbitrator and it has devices connected one after each other. There is only one wire to connect devices to bus master

– Centralized-Parallel arbitration – all devices are connected to a bus master with their own separate lines. Then the bus arbitrator decides who uses the bus

Page 25: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Centralized-Parallel Arbitration

Page 26: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Daisy Chain Arbitration

Slow, but simple and cheap

Page 27: IT253: Computer Organization Lecture 13: Input/Output Tonga Institute of Higher Education

Bus Summary