INPUT/OUTPUT SYSTEM
Processors need a source of input data and a destination for output data.Processors also require storage space for large volumes of intermediate data.Thus the I/O system provides these storage facilities by connecting the processor’ s memory to the I/O devices.[1] These devices vary widely in latency and bandwidth;[2] thus,a major function of the I/O system is to match their latencies and bandwidths to that of the memory system.I/O devices consist of such diverse items as keyboards,modems,and hard disks.Each of these devices has its own latency and bandwidth requirements that must be satisfied for a properly functioning system.
The major tasks of the I/O system are the following:
(1)to establish the connection between the memory and the I/O devices;
(2)to synchronize and manage the control of the data transfer;
(3)to provide buffering when the source and sink bandwidths and latencies differ;
(4)to perform code conversions if required;
(5)to interrupt the processor when required;
(6)to terminate the operation when it is completed.
These tasks are accomplished by hardware and software,in varying amounts of each.The more hardware-oriented,the higher the performance and the higher the hardware cost.The more software-oriented,the lower the performance and the lower the hardware cost.Control can be classified into two broad categories:grogrammed I/O and coprocessor I/O.
Programmed I/O
Programmed I/O,also known as direct I/O,is accomplished by a program executing on the processor itself to control the I/O operations and transfer the data.With programmed I/O,shown in Fig. 1-12,there are several architectural registers(minimally an input register and an output register)that are addressed by special move instructions.[3]

These move instructions move information from the accurnulator(or general-purpose register)to/from the I/O registers.The peripherals are connected directly to the bits of these registers. [4]
输入输出(I/O)系统
处理器需要有输入数据的源设备和用于数据输出的目的设备。它还要求有存储大量中间数据的存储空间,I/O系统就是通过把处理器的存储器与I/O设备连接起来的存储设施。这些设备在等待时间和带宽上是大不相同的;因此I/O系统的主要功能是使其在执行时间和带宽上与存储系统协调起来。I/O设备包括键盘、调制解调器和硬盘等多种设备。对每种设备自身的等待时间和带宽,必须满足系统正确操作的要求。
I/O系统的主要任务是:
(1)建立存储器和I/O设备之间的连接;
(2)对数据传输的控制进行同步化与管理;
(3)当信源和信宿的带宽和等待时间不同时,提供缓存功能;
(4)需要时完成代码的转换;
(5)需要时中断处理器的工作;
(6)任务完成时终止操作。
这些任务都是通过硬件和软件完成的,不过对硬件或软件的依赖程度各不相同。越是依靠硬件,则性能越高,硬件成本越大;越是依靠软件,则性能越差,硬件费用越低。控制方法可以分为两大类:程序控制I/O和协处理器I/O。
程序控制I/O
程序控制I/O,又称直接I/O,由在处理器上执行的程序去控制I/O操作和传送数据。如图1-12所示的程序控制I/O,有几个体系结构寄存器(至少1个输入寄存器和1个输出寄存器),它们由专用的传送指令寻址。
这些传送指令在累加器(或通用寄存器)和I/O寄存器之间传送信息,而外围设备直接与每个寄存器相连。