Pages

Tuesday, March 22, 2011

I/O

1. What is input –output interface? Discuss different types of interfaces?
Input-Output Interface: Input-Output Interface provides a method for transferring information between internal storage and external I/O devices. Peripherals connected to a computer need special communication links for interfacing them with the central processing unit. The purpose of the communication link is to resolve the differences that exist between the central computer and each peripheral. Data transfer rate of systems include special hardware components between the CPU and peripherals to supervise and synchronize all input transfers. These components are called interface units because they interface between the processor bus and the peripheral device.
There are basically 2 types of interfaces. 1) Parallel Interface 2) Serial Interface
In Parallel interface, there are multiple lines connecting the I/O module and the peripheral, and multiple bits are transferred simultaneously that is all the bits of a word are transferred simultaneously over the data bus. In serial interface there is only one line used to transmit data and bits are transmitted one at a time. A parallel Interface is commonly used for higher-speed peripherals. Like tape and disk where as serial is used for printer and terminals
In addition, each device may have its own controller that supervises the operations of the particular mechanism in the peripheral.
I/O Bus and Interface Modules: A typical communication link between the processor and several peripherals is designed in order to attain a full fledged communication between them. The I/O bus consists data lines, address lines and control lines. The magnetic disk, printer, and terminal are employed in particularly any general purpose computer. The magnetic tape is used in some computers for backup storage. Each peripherals device has associated with it an interface unit. A controller may be housed separately or may be physically integrated with the peripheral. The I/O bus from the processor is attached to all peripheral interfaces.
To communicate with a particular device, the processor places a device address on the address lines. A interface unit is associated with each peripheral device and its function is to decode the address lines and find out whether the address belongs to that device. Once the interface decodes the signal on the address lines and identifies that the address belongs to the peripheral associated with the interface, the peripheral device is switched on. Each peripheral has controller associated with the device. Like, if the output device is a printer, the printer controller controls the movement of paper, aligning in the proper place and selecting the printing characters to be printed. A peripheral controller is either integrated with the device or housed as part of the device. Once the control is set properly, data may be transferred from the CPU to peripheral device or vice versa through data lines. Below figure shows the Interfacing CPU to Peripheral devices.
2Q : Discuss I/O versus Memory Bus
I/O Versus Memory Bus: Processor should communicate with both I/O and memory unit like the I/O bus, the memory bus contain data, address, and read/write control lines. There are three ways that computer buses can be used to communicate with memory and I/O.
1. Use two separate buses, one for memory and the other for I/O
2. Use one common bus for both memory and I/O but have separate control lines for each.
3. Use one common bus for memory and I/O with common control lines.
In first method, the computer has independent sets of data, address and control buses, one for accessing memory and the other for I/O. And it is done in computers which provide a separate I/O processor (I/O processor) in addition to the central processing unit (CPU). The memory communicates with both the CPU and the I/O processor through a memory bus. The I/O processor communicates with both the CPU and I/O processor through a memory bus. The I/O processor also communicates with the input and output devices through a separate I/O bus with its own address, data and control lines. The purpose of the I/O processor is to provide an independent pathway for the transfer of information between external devices and internal memory. The I/O processor is sometime also known as data channel.

3Q. Differentiate between memory mapped and isolated I/O
Ans : Many computers use on common bus to transfer information between memory or I/O and the CPU. The distinction between a memory transfer and I/O transfer is made through separate read and write lines. The CPU specifies whether the address on the address lines is for a memory word of for an interface register by enabling one of two possible read or write lines. This configuration isolates all I/O interface address from the address assigned to memory and is referred to as the isolated I/O method for assigning address in a common bus.
Isolated I/O : Isolated I/O is a configuration maintaining independent set of input and output instructions. The central processing unit receives the opcode of a given instruction, decodes it and transmits the address of the given peripheral device on the common address lines shared by processor, memory and other I/O peripherals. Therefore, CPU performs the derived operation that is either I/O read or I/O write control lines.
Memory mapped I/O : The CPU maintains common address space for both units that is memory as well as I/O Unit. Therefore, the CPU utilizes the registers such as data and status registers which belongs to I/O Units as a memory space for storing various addresses.

4Q. Explain in detail about different modes of transfers:
Ans : Modes of Transfer : The CPU merely executes the I/O instructions and may accept the data temporarily, but the ultimate source or destination is the memory unit. Data transfer between the central computer and I/O devices may be handled in a variety of modes. Data transfer to and from peripherals may be handled in one of the three possible modes:
1) Programmed I/O
2) Interrupt Driven I/O
3) Direct memory access (DMA)
Programmed I/O : In Programmed I/O approach, the transfer of data item is initiated by an instruction in the computer program. The data transfer in between a CPU register and ( a register in the ) peripheral and is useful in low speed computer systems to minimize hardware costs. The data is transferred between a register in CPU and another (buffer) register in the peripheral. For example, IN and OUT instructions in 8085 processor for performing data transfer between accumulator and a register in the peripheral devices. Some more instructions may be required to transfer the data into memory from accumulator on the CPU side and between the buffer ends into the appropriate location in the peripheral device.
A constant monitoring of the peripheral by CPU is required to transfer data under program control. The CPU is required to monitor the interface of the peripheral device to find out when and additional data transfer takes place. The instructions executed in CPU monitor the various registers to ensure that data transfer takes place smoothly without any overriding of data items or loss of data items. The CPU must stay in the program loop until the I/O interfacing unit informs that it is ready for data transfer to take place. And this mechanism keeps the processor busy for a very long time.
Interrupt-Driven I/O : Interrupt Driven I/O approach of data transfer reduces the requirements on processor time as compared to the programmed approach to input and output data transfer. An interrupt is used to indicate to the CPU that it is ready to accept data for transfer from CPU or a data item is available for transfer, CPU executes another program and therefore the demand on CPU time is reduced. During the period CPU is executing other programs, I/O interface monitors continually the external device and generates an interrupt signal (request) to the computer. CPU suspends the present task and branches to an interrupt service routine. When an interrupt signal is detected.
The interrupt service routine, which indicates the action required, is executed and at the end of the execution of interrupt service routine, CPU returns to the program that it was originally executing. The interruption of CPU Program is planned at the beginning of fetching any instruction, the system checks from any interrupt Driven I/O and programmed I/O are useful when the amount of data required to be transferred is small. Only one byte or word can be transferred each time. If large volumes of data are required to be transferred another approach is used.
Direct Memory Access: (DMA)
The Direct Memory Access is used for the transferring large volumes of data between main memory and a peripheral device through the memory bus. In the DMA approach the CPU initiates the data transfer by supplying the interface, the starting address of the data and the number of words of data the execution of other instructions. During DMA period, CPU will not be able to access memory to execute other instructions. The CPU allows the memory use to be controlled by IO data transfer during DMA operations. At the end of DMA operations. The CPU has to delay all memory access operations during direct memory – I/O transfer are much less frequent than processor to memory access operations.
Many computer systems use an I/O processor which combined the interface logic with direct memory access operations. A large number of peripheral devices can be handled by an I/O processor with the help of interrupts and DMA facility. Such computer system can be treated as serving three separate modules. A memory unit, CPU and an I/O Processor.