It is important to notice that the previous designations of devices as either input or output change when the perspective changes. Mice and keyboards take as input physical movement that the human user outputs and convert it into signals that a computer can understand. The output from these devices is treated as input by the computer. Similarly, printers and monitors take as input signals that a computer outputs. They then convert these signals into representations that human users can see or read. (For a human user the process of reading or seeing these representations is receiving input.)
In computer architecture, the combination of the CPU and main memory (i.e. memory that the CPU can read and write to directly, with individual instructions) is considered the heart of a computer, and any movement of information from or to that complex, for example to or from a disk drive, is considered I/O. The CPU and its supporting circuitry provide I/O methods that are used in low-level computer programming in the implementation of device drivers.
Higher-level operating system and programming facilities employ separate, more abstract I/O concepts and primitives. For example, operating system provides application programs with the concept of files. C programming language defines functions that allow programs to perform I/O through streams, such as read data from them and write data into them.
A rare alternative to special primitive functions is the I/O monad that permits programs to just describe I/O, and the actions are carried out outside the program. This is notable because the I/O functions would introduce side-effects to any programming language but now purely functional programming is practical.
No comments:
Post a Comment