There are three ways to send information in I/O
1. Polling
2. Interrupt-driven I/O
3. DMA (Direct Memory Access)
Polling: The simplest way to let I/O device communicate with the CPU. As long as I/O device puts information status Register,cpu periodically checks and gets information to know the device that needs to be serviced.
interrupt-driven I/O: With Interrupt, when an I/O device needs to be serviced, it will be Interrupt to notify the CPU. An I/O interrupt for the instruction is the Asynchronous,control unit needs to check for pending I/O interrupt when a new command is executed. I/O interrupt also conveys more information, such as which device has the interrupt and its priority.
DMA (Direct Memory Access): Provides a device controller that allows I/O device to transmit information directly to the memory without the need for CPU participation.
Three steps for DMA transfer
1. The CPU initializes the DMA controller, which includes providing the name of the I/O device, the running calculation, the memory location, and the number of bytes to be sent.
2. DMA starts. If the request requires more than one transfer on the bus, the DMA unit generates the next memory address and the initial transfer.
3. Once the DMA transfer is complete, the DMA controller has a interrupt to the CPU.
Compare
|
Polling |
Interrupt-driven I/O |
Dma |
Advantages |
Easy to perform, can use software to change the CPU polling sequence |
Without a lot of time on polling. |
Suitable for high speed devices Without a lot of time on polling. |
Lack of a bit |
Because CPU speed is much faster than I/O device, it will be wasted time on polling Not suitable for high-bandwidth devices |
Need to have interrupt signals and interrupt service routine exist Not suitable for high-bandwidth devices |
Need to have DMA contro |
"Interface" "SPI" Polling Interrupt DMA