I/O management of operating system: 1. I/O controller, I/O control mode (program direct control mode, interrupt drive mode, DMA mode, channel control mode)

Basic knowledge

mind Mapping

Insert picture description here

What is an I/O device?

Insert picture description here

classification

Insert picture description here
Insert picture description here![Insert picture description here
Insert picture description here

I/O controller

mind Mapping

Insert picture description here

I/O controller function

Insert picture description here

The composition of the I/O controller

Insert picture description here
Insert picture description here

Memory mapped I/O vs independent register addressing

Insert picture description here

I/O control method

1. Direct program control method

Insert picture description here
Insert picture description here

In order to solve the shortcomings in the above methods, an interrupt-driven method was created

2. Interrupt drive mode

Insert picture description here

Compared with direct program control, the differences are:
1. After the CPU sends a read/write command, the process waiting for I/O can be blocked and switched to another process for execution.
2. After the I/O is completed, the controller will The CPU sends out an interrupt signal. After the CPU detects the interrupt signal, it saves the operating environment information of the current process and then executes the interrupt handler to handle the interrupt.
3. The CPU reads a word of data from the I/O controller and transfers it to the CPU register, and then writes it to the main memory.
Problem: It is necessary to save and restore the operating environment of the process during interrupt processing. This process requires a certain amount of time and overhead. It can be seen that if the frequency of interrupts is too high, system performance will also be reduced; each word transfer between the I/O device and the memory needs to pass through the CPU. To this end, the DMA method is proposed.

3. DMA mode (direct memory access)

Insert picture description here

1. The operation from the CPU to the I/O is completed by the DMA controller, and the data transmission is not processed by the CPU. The CPU only needs to intervene at the beginning and end of transmitting one or more data blocks.
2. Different from the interrupt-driven mode, one more DMA controller is added for data transmission.
3. DMA controller:
Insert picture description here
1. It can be seen from the DMA control diagram that the data transfer from memory to I/O devices can be completed through DMA, which does not require CPU intervention, which greatly improves the parallel efficiency between CPU and I/O devices
2. The CPU is only responsible for issuing requests to I/O devices and receiving interrupts when the data transmission is complete

Insert picture description here

4. Channel control method

Insert picture description here

The channel control method is different from the DMA method: when the CPU requests an I/O device, it will first add a task to the task list in the memory, and then the channel checks the task list in the memory. If there is a task, the channel is responsible for communicating with the I/O device. data transmission. Therefore, a set of data blocks can be read and written each time.

Insert picture description here

Compared

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41587740/article/details/109068412