The i/o technique where the processor busy waits for an i/o operation to complete is called:

Goals of the I/O Software

  • A key concept in the design of I/O software is known as device independence. It means that I/O devices should be accessible to programs without specifying the device in advance.
  • Uniform Naming, simply be a string or an integer and not depend on the device in any way. In UNIX, all disks can be integrated in the file-system hierarchy in arbitrary ways so the user need not be aware of which name corresponds to which device.
  • Error Handling: If the controller discovers a read error, it should try to correct the error itself if it can. If it cannot, then the device driver should handle it, perhaps by just trying to read the block again. In many cases, error recovery can be done transparently at a low level without the upper levels even knowing about the error.
  • Synchronous (blocking) and Asynchronous (interrupt-driven) transfers: Most physical I/O is asynchronous, however, some very high-performance applications need to control all the details of the I/O, so some operating systems make asynchronous I/O available to them.
  • Buffering: Often data that come off a device cannot be stored directly in their final destination.
  • Sharable and Dedicated devices: Some I/O devices, such as disks, can be used by many users at the same time. No problems are caused by multiple users having open files on the same disk at the same time. Other devices, such as printers, have to be dedicated to a single user until that user is finished. Then another user can have the printer. Introducing dedicated (unshared) devices also introduces a variety of problems, such as deadlocks. Again, the operating system must be able to handle both shared and dedicated devices in a way that avoids problems.

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:

  • The processor is executing a program and encounters an instruction relating to I/O operation.
  • The processor then executes that instruction by issuing a command to the appropriate I/O module.
  • The I/O module will perform the requested action based on the I/O command issued by the processor (READ/WRITE) and set the appropriate bits in the I/O status register.
  • The processor will periodically check the status of the I/O module until it find that the operation is complete.

Programmed I/O Mode: Input Data Transfer

  • Each input is read after first testing whether the device is ready with the input (a state reflected by a bit in a status register).
  • The program waits for the ready status by repeatedly testing the status bit and till all targeted bytes are read from the input device.
  • The program is in busy (non-waiting) state only after the device gets ready else in wait state.

The i/o technique where the processor busy waits for an i/o operation to complete is called:

Programmed I/O Mode: Output Data Transfer

  • Each output written after first testing whether the device is ready to accept the byte at its output register or output buffer is empty.
  • The program waits for the ready status by repeatedly testing the status bit(s) and till all the targeted bytes are written to the device.
  • The program in busy (non-waiting) state only after the device gets ready else wait state.

The i/o technique where the processor busy waits for an i/o operation to complete is called:

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:

  • Control
  • Test
  • Read
  • Write

The i/o technique where the processor busy waits for an i/o operation to complete is called:

Advantages of Programmed I/O

  • Simple to implement
  • Very little hardware support

Disadvantages of Programmed I/O

  • Busy waiting
  • Ties up CPU for long period with no useful work

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

  • CPU issues read command.
  • I/O module gets data from peripheral whilst CPU does other work.
  • I/O module interrupts CPU.
  • CPU requests data.
  • I/O module transfers data.

The i/o technique where the processor busy waits for an i/o operation to complete is called:

Advantages of Interrupt-Driven I/O

  • Its faster than Programmed I/O.
  • Efficient too.

Disadvantages of Interrupt-Driven I/O

  • It can be tricky to write if using a low level language.
  • It can be tough to get various pieces to work well together.

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

  • Read or Write Command
  • Control Lines Communication
  • Data Lines Communication

The i/o technique where the processor busy waits for an i/o operation to complete is called:
The i/o technique where the processor busy waits for an i/o operation to complete is called:

Advantages of DMA

  • Speed: no waiting due to much shorter execution path and no rotation delay.
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;

  • Programmed I/O

Credits

  • Interrupts: By Stephen Charles Thompson (anon_lynx) - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=23385273

When the program has instructions to access the I O device it is called?

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.

In which type of I/O Does the CPU execute special instructions to read and write the I O ports?

7.4.2 I/O Mapped Input/Output I/O-mapped input/output uses special instructions to access I/O ports. Many CPUs do not provide this type of I/O, though the 80x86 does.

What is program controlled I O technique?

This I/O technique is the simplest to exchange data between external devices and processors. In this technique, the processor or Central Processing Unit (CPU) runs or executes a program giving direct control of I/O operations.

Is an I/O technique that allows a control unit to directly access main memory?

This type of data transfer technique is known as DMA or direct memory access. During DMA the CPU is idle and it has no control over the memory buses. The DMA controller takes over the buses to manage the transfer directly between the I/O devices and the memory unit.