Blocking, nonblocking, asynchronous, buffered, unbuffered, double buffered, programmed I/O, DMA

Here are all I/O related concepts.

Blocking I/O: process is blocked until all bytes are ready.

Non-blocking I/O: the OS only reads or writes as many bytes as is possible without blocking the process.

Asynchronous I/O: similar to non-blocking I/O. The I/O call returns immediately, without waiting for the operation to complete. I/O subsystem signals the process when I/O is done. Same advantages and disadvantages of non-blocking I/O.

Difference between non-blocking and asynchronous I/O: a non-blocking read() returns immediately with whatever data available; an asynchronous read() requests a transfer that will be performed in its entirety, but that will complete at some future time

Buffered I/O: allows the kernel to make a copy of the data and adjust to different device speeds.

Double buffered I/O: decouple producer of data from customer, thus relaxing timing requirement between them.

Programmed I/O: General-purpose processor watch status bits and feed data into a controller register one byte at a time. Each byte is transferred via processor in/out or load/store.
Pro: simple hardware, easy to program
Con: consumes process cycles proportional to data size

DMA: Offloading transferring work to a special-purpose processor called DMA controller. Give controller access to memory bus. Ask it to transfer to/from memory directly.

Leave a Comment