An I/O interface is required whenever the I/O device is driven by a processor. Typically a CPU communicates with devices via a
bus. The interface must have the necessary logic to interpret the device address generated by the processor.
Handshaking should be implemented by the interface using appropriate commands (like BUSY, READY, and WAIT), and the processor can communicate with an I/O device through the interface. If different data formats are being exchanged, the interface must be able to convert serial data to parallel form and vice versa. Because it would be a waste for a processor to be idle while it waits for data from an input device there must be provision for generating
interrupts With some devices able to exchange data at very high speeds
direct access to memory (DMA) without the continuous aid of a CPU is required.
Higher-level implementation Higher-level
operating system and programming facilities employ separate, more abstract I/O concepts and
primitives. For example, most operating systems provide application programs with the concept of
files. Most programming languages provide I/O facilities either as statements in the language or as
functions in a standard library for the language. An alternative to special primitive functions is the
I/O monad, which permits programs to just describe I/O, and the actions are carried out outside the program. This is notable because the functions would introduce
side-effects to any programming language, but this allows
purely functional programming to be practical. The I/O facilities provided by operating systems may be
record-oriented, with files containing
records, or stream-oriented, with the file containing a stream of bytes. ==Channel I/O==