Interrupt, DMA, Channel

Source: Internet
Author: User

I. Round Robin
The program polling Method for I/O devices is a management method for I/O devices by early computer systems. It regularly asks various devices in turn for processing requirements. Take turns to ask, if there is a requirement, it will be processed. After processing the requirements of the I/O device, the processor returns to continue working.
Despite the time required for round-robin, round-robin is much faster than that of I/O devices, so there is generally no problem that cannot be handled in a timely manner.
Of course, the number of input and output devices that can be processed by a faster processor is also limited. In addition, program polling occupies a considerable amount of processing time on the CPU. Therefore, program polling is a low-efficiency method and is rarely used in modern computer systems.

Ii. interrupt mode
The high speed of the processor conflicts with the low speed of the input and output devices, and is an important issue for device management. To improve overall efficiency and reduce data transmission between CPUs in the direct control mode of the program, it is necessary.
The data transmission steps between the central processor and the I/O device are as follows:
(1) When a process requires data, issue a command to start the input/output device to prepare data.
(2) After a process sends a command to start the device, the process abandons the processor and waits for the relevant I/O operations to complete. In this case, the process scheduler schedules other ready processes to use the processor.
(3) When I/O operations are completed, the input/output device controller sends an interrupt signal to the processor through the interrupt request line. After the processor receives the interrupt signal, it switches to the preset interrupt processing program, process data transmission.
(4) The data process is transferred to the ready state. At a later time, the process scheduler selects the process to continue working.
Advantages and disadvantages of Interrupt Methods
The interrupt mode of the I/O device improves the utilization of the processor and supports parallel operations on multiple programs and I/O devices.
However, there are still some problems with the interruption Method. First, modern computer systems are usually configured with a variety of input and output devices. If these I/O devices perform parallel operations in the same way as the interrupt processing method, the sharp increase in the number of interruptions will cause the CPU to respond to the interruption and data loss.
Second, if the data buffer of the I/O controller is small, it will be interrupted when the buffer is full of data. Therefore, there are many opportunities for interruption during data transmission, which will consume a lot of CPU processing time.

Iii. Direct Memory Access (DMA)
Direct Memory Access means that data is directly transmitted in blocks between memory and I/O devices.
DMA Technical Features
DMA has two technical features: direct transmission and block transmission.
Direct transmission means that when a data block is transmitted between the memory and the IO Device, no intermediate interference from the CPU is required, you only need the CPU to send the "transmit block data" command to the device at the beginning of the process, and then the process is terminated and the next operation is ready through interruption.
DMA Operation Process
(1) When the process requires the device to input data, the CPU sends the memory start address to store the input data and the number of bytes to be transferred to the memory address register in the DMA controller and the transfer byte counter respectively.
(2) The request for sending data transmission enters the waiting state. The CPU command being executed is temporarily suspended. The process scheduler schedules other processes to occupy the CPU.
(3) The input device constantly steals the CPU cycle and continuously writes data in the data buffer register to the memory until all required bytes are transferred.
(4) When the DMA controller transmits all bytes, it sends an interrupt signal through the interrupt request line. After the CPU receives the interrupt signal, it is transferred to the Interrupt Processing Program for subsequent processing.
After the worker Interrupt Processing ends, the CPU returns to the interrupted process, or switches to the context of the new process to continue execution.
What is the difference between DMA and interrupt?
(1) interrupt occurs when the data buffer register is full and the CPU is required to interrupt the processing, however, the DMA mode requires the CPU to interrupt processing when all the data blocks required to be transferred are transferred. This greatly reduces the number of times the CPU is interrupted.
(2) interrupt data transmission is completed by CPU control during interrupt processing, while the DMA mode is not completed by CPU control under the control of the DMA controller. This eliminates the possibility of too many parallel devices to process and data loss due to speed mismatch.
Advantages and disadvantages of DMA
In the DMA mode, I/O is more efficient because I/O devices exchange block data directly with the memory. DMA technology can improve I/O efficiency, so it has been widely used in modern computer systems. Many controllers of input and output devices, especially Block devices, support the DMA mode.
From the above analysis, we can see that the strength of the DMA controller is a key factor determining the DMA efficiency. The DMA controller needs to do a lot of work for each data transmission. Increasing the data transmission unit means a decrease in the number of transfers. In addition, the DMA mode steals the entire cycle, and the CPU processing efficiency is reduced. To minimize the duration, we must try to improve the performance of the DMA controller, which can reduce the CPU output efficiency.

Iv. Channel Mode
The input/output channel is a CPU-independent processor dedicated to managing I/O. It controls the direct data exchange between devices and memory. It has its own channel commands, which are started by the CPU and interrupt the CPU at the end of the operation, as shown in Figure 6-3.
The input/output channel control is a memory-centric control method that enables direct data exchange between devices and internal systems. In the channel mode, data transmission direction, memory start address for storing data, and data block length are all controlled by the channel.
In addition, the channel control mode allows one channel to control multiple devices and memory for data exchange. Therefore, the channel method further reduces the CPU workload and increases the parallel operation degree of computer systems.
Input/output channel category
Based on different information exchange methods and connected devices, channels can be divided into the following three types:
(1) byte Multi-Channel
It is suitable for low-speed or medium-speed I/O devices connected to printers and terminals. These channels work in bytes: when one byte is transferred for one device, it is immediately transferred to another device.
(2) Select a channel
It is suitable for connecting high-speed devices such as disks and tapes. This channel works in a "group" mode. Each time a batch of data is transmitted, the transmission speed is very high, but it can only serve one device for a while. After an I/O request is processed, select another device and serve it.
(3) grouped Multi-Channel
This channel combines the time-based work of Multi-byte channels and the high transmission rate of the selected channel. Its essence is that it uses multi-channel programming technology to allow devices connected to the channel to work in parallel.
How the channel works
In channel control mode, the I/O device controller (I/O controller) does not transmit byte counters and memory address registers, however, there is an additional channel device controller and Command Execution Component. The CPU only needs to issue the startup command, indicating the corresponding operations of the channel and the I/O device. This command can start the channel and enable the channel to call up the corresponding channel command execution from the memory.
Once the CPU sends a command to start the channel, the channel starts to work. The I/O channel controls the I/O controller, and the I/O controller controls the I/O device. In this way, one channel can connect multiple I/O controllers, and one I/O controller can connect several external devices of the same type.
Channel Connection
Because the number of channels and controllers is generally less than the number of devices, improper connection may lead to a "bottleneck ". Therefore, the connection of a device generally uses a cross-connection. The advantage of this is:
① Improve System Reliability: When a channel is disconnected due to a controller or channel failure, other channels can be used.
② Improve the concurrency of devices: For the same device, when the Controller or channel in a channel connected to it is occupied, you can select another idle path, this reduces the time required by the device to wait for a path.
Channel Processor
A channel is equivalent to a simple processor. It has its own command system, including instructions for reading, writing, control, transfer, termination, and empty operations, it can also execute channel programs written by these commands.
The operational control components of the channel include:
① Channel address (CAW): records the address where the next channel command is stored. Its function is similar to the central processor's command register.
② Channel command (CCW): records the channel commands being executed, which act as the central processor's command register.
③ Channel status (CSW): records the status of the channel, Controller, and device, including the I/O transmission completion information, error information, and repeated executions.
Channel Access to the host
The channel generally needs to share the same memory with the host to save the channel program and exchange data. Channel Access Memory uses the "Periodic theft" method.
After the channel is used, the input/output execution process is as follows:
When the CPU executes a user program, it encounters an I/O Request and generates a channel program based on the user's I/O Request (which can also be prepared in advance ). Put it in the memory, and put the first address of the channel program into caw.
Then, the CPU executes the "start I/O" command to start the channel. The channel receives the "start I/O" command signal, extracts the first address of the channel program from the caw, extracts the First Command of the channel program based on the address, and puts it into the CCW; at the same time, a response signal is sent to the Cu, notifying the completion of the "start I/O" command, and the CPU can continue to execute.
The channel starts to execute the channel program for physical I/O operations. After executing a command, if there is another command, continue to execute; otherwise, it means the transmission is complete and stops at the same time, notifying the CPU to switch to process the channel end event, and get the status of the channel from CCW.
In short, in the channel, I/O uses a dedicated auxiliary processor to process I/O operations, thus reducing the burden on the main processor to process I/O. The main processor only needs to issue an I/O operation command, and the rest of the work is the responsibility of the channel. After an I/O operation is completed, the I/O channel sends an interrupt request, indicating that the operation has been completed.
Channel development
The idea of the channel has evolved from an early large-scale computer system. A large number of I/O devices are usually installed in early large-scale computer systems. In order to separate the management of I/O devices from the computer host, the concept of I/O channels is formed and I/O channel processors are specially designed.
The I/O channel is a very important component in computer systems and plays an important role in improving the overall system performance. However, with the continuous development of technology, the performance of processors and I/O devices is constantly improved, and dedicated and independent I/O channel processors are not easy to see. However, the channel idea is integrated into many new technologies, so it is still widely used. Because the fiber channel technology has the advantages of high data transmission rate, long data transmission distance, and can simplify the design of large storage systems, the new generic fiber channel technology is developing rapidly. This generic fiber channel can accommodate up to 127 large-capacity hard drive on one channel. Obviously, in the field of large-capacity and high-speed storage, generic Fiber Channel has a wide range of application prospects.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.