Modes Of Data Transfer

The Data from an external device is usually stored in memory unit. The CPU only executes I/O instructions and may accept data temporarily, but the ultimate source or destination is memory unit. Information transferred from central computer into an an external device also is originally from the memory. The transfer between central computer and Input/Output devices may be handled in a variety of modes :

  1. Programmed I/O
  2. Interrupt - initiated I/O
  3. Direct Access Memory (DMA)

1. Programmed I/O : In programmed I/O mode, when an input output instruction is occurred in a program, the CPU checks the input output flag. It continuously checks the flag till the flag is set to 1. When the flag is set to 1, the CPU sends the data from the I/O device to the memory. These operations are a results of I/O instructions written in the computer program. data transfer is initiated by an instruction in the program. Usually the data transferred between CPU register and peripheral device. Other instructions are used to transfer data between CPU and memory. The peripheral has to be constantly monitored. Once a data transfer is initiated, the CPU is required to monitor the interface to see when a transfer can again be made.

2. Interrupt - initiated I/O : In this scheme, CPU may allow devices to send a signal when input is waiting to be processed. The signal is used to interrupt the CPU. Interrupt signal are seen directly (using hardware) to micro-processor which may or may not ignore interrupt request. when request is granted, CPU will suspend its current program execution, execute an interrupt handler program and then resume execution  of the interrupted program. Interrupted initiated I/O can be avoided by using an interrupt facility and special commands to inform the interface to issue an interrupt request signal when the data are available from the device. Meanwhile, CPU can proceed to execute another program. the interfaces keeps monitoring the device. When the interface determine that the device is ready for data transfer, it generates an interrupt request to the computer.

3. Direct Access Memory (DMA) : To transfer large block of data at high speed, a special control unit may be provided to allow transfer of a block of data directly between an external device and the main memory, without continuous intervention by the processor. This approach is called direct memory access or DMA. DMA transfers are performed by a control circuit associated with the I/O device and this circuit is referred as DMA controller. The DMA controller allows direct data transfer between the device and the main memory without involving the processor.

To transfer data between memory and I/O devices, DMA controller takes over the control of the system from the processor and transfer of data take place over the system bus. For this purpose, the DMA controller must use the bus only when the processor does not need it, or it must force the processor to suspend operation temporarily. The later technique is more common and is referred to as cycle stealing, because the DMA module in effect steals a bus cycle. The typical block diagram of a DMA controller is shown in the Figure below :

When the processor wishes to read or write a block of data, it issues a command to the DMA module, by sending to the DMA module the following information.
  • Whether a read or write is requested, using the read or write control line between the processor and the DMA module. 
  • The address of the I/O devise involved, communicated on the data lines.
  • The starting location in the memory to read from or write to, communicated on data lines and stored by the DMA module in its address register. 
  • The number of words to be read or written again communicated via the data lines and stored in the data count register.

The processor then continues with other works. It has delegated this I/O operation to the DMA module. The DMA module checks the status of the I/O devise whose address is communicated to DMA controller by the processor. If the specified I/O devise is ready for data transfer, then DMA module generates the DMA request to the processor. Then the processor indicates the release of the system bus through DMA acknowledge. The DMA module transfers the entire block of data, one word at a time, directly to or from memory, without going through the processor. When the transfer is completed, the DMA module sends an interrupt signal to the processor. After receiving the interrupt signal, processor takes over the system bus.

Next Topic :

No comments:

Post a Comment