Input/output, commonly known as I/O, is the communication that goes on between a information processing system and the outside world, which may be a person or another information processing system. The signals and data received by the system are known as inputs, and the signals and data sent from the system are known as outputs. I/O can also refer to an action as well. An input or output operation can perform as I/O. I/O devices are used by a person or system to communicate with computers. For example, a keyboard is considered an input device for a computer, while a printer is considered an output device. Some devices can be used for input and output, such as modems and network cards.
Computers were designed so that the combination of the CPU and main memory is considered the brain of a computer. This also means that from that point of view, any transfer of information to or from that combination is considered I/O. The CPU and the circuitry that sustains it provide memory-mapped I/O that is used in low-level computer programming in the completion of device drivers. An I/O algorithm is designed to take advantage of location and perform efficiently when data is stored on a secondary storage device, like a disk drive.
When the I/O device is driven by the processor, I/O interface is required. The interface has to be equipped with the essential logic to interpret the device address given by the processor. Handshaking should be put into practice by the interface using appropriate commands such as (BUSY, READY, and WAIT) in order to enable the processor to communicate with 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. There also has to be certain conditions set for generating interrupts and the corresponding type numbers for further processing by the processor if necessary. If a computer uses memory-mapped I/O, it accesses hardware by reading and writing to specific memory locations. When doing this, the computer uses the same assembler language instructions that it would normally use to access memory.
Higher-level operating systems and programming facilities utilize separate and more conceptual I/O concepts. For example, many operating systems supply application programs through files. The C and C++ programming languages usually summarize files and devices into streams, which can be read or written. The C standard library provides functions for manipulating streams for input and output. The I/O monad, which permits programs to describe I/O and carry out the actions outside the program, is an alternative to special primitive functions. This is significant because the I/O functions would bring in side-effects to any programming language; however, purely functional programming is now more practical.
Data can be read and stored in the computer’s memory in many different ways. Each process is known as an addressing mode, and each has its own positives and restrictions. There are many types of addressing modes such as direct addressing, indirect addressing, immediate addressing, index addressing, based addressing, based-index addressing, and implied addressing. In direct addressing, the data is a part of the instruction. When the processor decodes the instruction, it gets the memory address from where it can be read and stored. With indirect addressing, the address can be stored in a register. The instruction will have the register, and the register will have the address. In order to retrieve the data, the instruction must be decoded using the appropriate register. The contents of the register will be treated while the address is selected and data is read or written.