Principles of I/O Software

Goals of the I/O Software

Programmed I/O

This is one of the three fundamentally different ways that I/O can be performed. The programmed I/O was the most simple type of I/O technique for the exchanges of data or any types of communication between the processor and the external devices. With programmed I/O, data are exchanged between the processor and the I/O module. The processor executes a program that gives it direct control of the I/O operation, including sensing device status, sending a read or write command, and transferring the data. When the processor issues a command to the I/O module, it must wait until the I/O operation is complete. If the processor is faster than the I/O module, this is wasteful of processor time. The overall operation of the programmed I/O can be summaries as follow:

Programmed I/O Mode: Input Data Transfer

Programmed I/O Mode: Output Data Transfer

Programmed I/O Commands

To execute an I/O-related instruction, the processor issues an address, specifying the particular I/O module and external device, and an I/O command. There are four types of I/O commands that an I/O module may receive when it is addressed by a processor:

Advantages of Programmed I/O

Disadvantages of Programmed I/O

Interrupt-Driven I/O

Interrupt driven I/O is an alternative scheme dealing with I/O. Interrupt I/O is a way of controlling input/output activity whereby a peripheral or terminal that needs to make or receive a data transfer sends a signal. This will cause a program interrupt to be set. At a time appropriate to the priority level of the I/O interrupt. Relative to the total interrupt system, the processors enter an interrupt service routine.

Interrupt I/O Inputs

For input, the device interrupts the CPU when new data has arrived and is ready to be retrieved by the system processor. The actual actions to perform depend on whether the device uses I/O ports or memory mapping.

Interrupt I/O Outputs

For output, the device delivers an interrupt either when it is ready to accept new data or to acknowledge a successful data transfer. Memory-mapped and DMA-capable devices usually generate interrupts to tell the system they are done with the buffer.

Operations in Interrupt I/O

Advantages of Interrupt-Driven I/O

Disadvantages of Interrupt-Driven I/O

I/O Using DMA

Direct Memory Access is a technique for transferring data within main memory and external device without passing it through the CPU. DMA is a way to improve processor activity and I/O transfer rate by taking-over the job of transferring data from processor, and letting the processor to do other tasks. This technique overcomes the drawbacks of other two I/O techniques which are the time consuming process when issuing a command for data transfer and tie-up the processor in data transfer while the data processing is neglected. It is more efficient to use DMA method when large volume of data has to be transferred. For DMA to be implemented, processor has to share its' system bus with the DMA module. Therefore, the DMA module must use the bus only when the processor does not need it, or it must force the processor to suspend operation temporarily.

Operations of Direct Memory Access

Advantages of DMA

Quiz
  1. Buffering is
    1. only important for input devices
    2. only important for output devices
    3. important for input and output devices
    4. only important for disk drives
  2. I/O errors should be handled
    1. at the highest level possible
    2. at the lowest level possible
    3. by a device driver
    4. by the user-level programs
  3. An advantage of a UNIX-type file system is that
    1. it consists of highly structured records
    2. files can be quickly searched due to their tree structure
    3. the OS knows the distinct type of each file
    4. all disks can be mounted in a single tree and made available by filename
  4. In order to avoid continual process switching to handle I/O OSes will employ
    1. directory heirarchies
    2. buffering
    3. uniform interfacing
    4. all of the above
Answers

1. c; 2. b; 3. d; 4. b;

External Links

Credits