IO Control Mode

IO Control Mode mainly have the below 4 types.

Program direct control method

The CPU sends a read command to IO module, and CPU will read the status of IO device from status register. If it is busy, it will continue to poll and check the status. If it is ready, it means that the IO device is ready and can read data from it. After reading the CPU in CPU register (IO->CPU), CPU also writes data to the memory (memory). After writing, execute the next set of instructions.

io control modde

Frequency of CPU intervention: Very frequent. CPU intervention is required before IO operation starts and after completion, and CPU needs to constantly poll and check while waiting for IO to complete.

Data flow

  • Read operation (data input): IO device->CPU->memory
  • Write operation (data output): memory->CPU->IO device

Advantages: Simple to implement. After read and write instructions, add some series of instructions to implement the loop check.

Disadvantages: CPU and IO devices can only work serially. The CPU needs to be polled and checked all the time. It is in a busy state for a long time, and CPU utilization rate is very low.

Interrupt driven method

IO device and CPU processing speed is very fast, so after CPU issues a read and write command, the process waiting for IO can be blocked and first switched to another process for execution. When the IO is completed, controller will send an interrupt signal to CPU. After CPU detects the interrupt signal, it will save the running environment information of current process and go to execute the interrupt handler. This enables CPU and IO devices to work in parallel.

Advantages: IO controller will actively report that IO has been completed through interrupt signal, and CPU no longer needs to constantly poll. CPU and IO devices can work in parallel, and CPU utilization is significantly improved.

Disadvantage: The transfer of each word between IO device and memory needs to go through CPU. And frequent interrupt processing will consume a lot of CPU time.

 

DMA (Direct memory access)

  1. The unit of data transfer is “block”.
  2. The flow of data is from device directly into the memory, or from memory directly to device. Not using CPU as an intermediary.
  3. Intervention of CPU is only required at the beginning and end of the transfer of one or more data blocks.

Before reading and writing, CPU needs to indicate how much data to read, where the data should be stored in memory, and where the data should be placed on external disk.

The DMA controller will complete read and write operations of data according to the requirements kicked out by CPU. After the transmission of entire block of data is completed, CPU will send an interrupt signal.

  • DR: Staging data from device to memory, or from memory to device.
  • MAR (memory address register):, MAR indicates where the data should be placed in memory when inputting again, and where the data to be output is placed in memory when outputting.
  • DC (Data Counter): Indicates the number of bytes remaining to be read/written
  • CR (command/register): used to store IO command sent by CPU, or the status information of device.
  • Frequency of CPU intervention: CPU intervention is only required at the beginning and end of the transfer of one or more data blocks.

The unit of data transfer is in blocks, and one or more blocks are read and written at a time (it should be noted that only continuous blocks can be read and written, and these blocks must also be continuous in the memory after being read into the memory)

The flow of data also no longer requires CPU intervention.

Advantages: The data transfer efficiency is in units of blocks, and the involvement of the CPU is further reduced. The parallelism of CPU and IO devices is further improved.

Disadvantage: The CPU issues an instruction that can only read or write one or more contiguous blocks of data. If the data blocks to be read or written are not stored continuously but discretely, then CPU has to issue multiple IO instructions respectively and perform multiple interrupt processing to complete.

 

Channel Control Mode

A channel is a kind of hardware, which can be understood as a “weak version of CPU”. A channel can only execute one type of channel instruction.

Because the channel is compared with CPU, CPU can process more types of instructions than the channel, that is to say, the channel executes a single instruction, and it shares the host’s memory with CPU.

Specific processing process: The CPU informs the channel of operation steps, and the channel program will list the operation instructions in a “task list” similar to that. Then CPU will not participate in the rest. After the channel has executed the instruction, an interrupt is issued to tell the CPU that I have finished processing, and then the CPU is processing the subsequent operations.

Advantages: CPU channels and IO devices can work in parallel, and resource utilization is extremely high.

Disadvantages: complex implementation, requires dedicated channel hardware support.

Facebook
Twitter
LinkedIn