Professional Documents
Culture Documents
0) Introduction
The fact that computers are digital machines means that it is important to present data and instructions to computers in a machine-readable form, and obtain the output in a form in which it is comprehensible to the Human mind.
5.1) Objectives
This chapter will concentrate on the performance of I/O operations by programcontrolled I/O using polling, the idea of interrupts and the hardware and software needed to support them and, finally, Direct memory access.
5.2) Content
5.2.1. Input-Output Organization In most systems the Processor, memory and I/O devices are connected through one or more data paths known as buses. A typical system organization includes: Input Output Devices Mouse Keyboard Graphics Card Sound Card Disk Dives Network Interfaces Bus signals The signals on the I/O Memory Bus can be divided into three categories Address lines Data lines Control Signals Synchronous busses may also contain a clock signal. Addressing a device There are two strategies for addressing I/O devices attached to the system bus. Memory mapped IO IO mapped IO
Page 130
Page 132
Table 6.4: I/O Devices System Interconnection The System Interconnection is established through the bus that enables shared communication link and uses one set of wires to connect multiple devices. Buses provide electronic interconnection among I/O devices, processors and memory and also define lowest level protocol for communication, that is,how word or block of data should be communicated on wires. The Bus performance and organization depends on thelength of wires and number of connected devices limit speed of bus. The higher-level bus can be designed to be fast, while lower-level buses allow for expansion. For example, processor, memory and I/O devices might all plug into backplane bus (e.g., VME bus) or I/O buses (e.g., SCSI) might tap into processor-memory bus. I/O Modules I/O module (controller) is the hardware required to connect I/O device to backplane bus or I/O bus to processor-memory bus. For example, disk controller, SCSI-bus controller.
Page 133
Figure 6.12: I/O Controller Hardware/Software Interface Operating system has major role because multiple processes need to access I/O devices and interrupts are often used to communicate information about I/O operations and lowlevel control of I/O devices is complex. OS must therefore provide several functions: Protection - control access of users to I/O devices such as reading a file on disk requires permission. abstraction - routines that handle low-level device operations interrupt-handling scheduling - equitable access to shared I/O resources and schedule accesses to enhance system performance Three types of communication are required in order to perform these functions: OS must be able to give commands to I/O devices (e.g., read, write, disk seek ) I/O device must be able to notify OS of successful completion or error (e.g., disk has completed seek) Data must be transferred between memory and I/O device (e.g., block read from disk must be written to memory) Giving Commands to I/O Devices OS must be able to address I/O device and supply one or more command words. The two methods are used to address device:
Page 134
Page 135
Figure 6.13: Methods of I/O Data blocks 5.2.5. Direct Memory Access (DMA) Most modern computer systems have special purpose circuitry to relieve the processor of the tedious task of moving data back and forth between I/O devices and memory Typical DMA transaction Processor configures DMA system with target memory address, I/O address and number of bytes to be transferred. DMA unit performs operation while processor works on other tasks and informs processor when task is complete by asserting an interrupt. Data Coherency with DMA The DMA system must be made to work with the cache system and the virtual memory scheme. Addresses modified by DMA activity must be checked against the cache contents and pages in main memory that are being accessed by DMA cannot be swapped out until the DMA activity is finished. IO Processors Certain high end systems contain dedicated coprocessors for handling I/O operations. The processor can configure the IO processor to perform a sequence of I/O operations or to continually monitor the status of one or more I/O devices by polling.
Page 136
Page 137
2 3
More decoding is required because the processor provides more address lines for accessing memory Separate memory control signals are used the control the I/O operations
No. 1
Programmed I/O Processor has to poll each I/O and so it cannot execute other instructions in sequence During polling, processor is busy and hence have serious and detrimental effect on system throughput Does not depend on the status of interrupt Does not need initialization of stack System throughput decreases as number of I/O devices connected in the system increases Implemented without interrupt hardware support.
3 4 5
Interrupt driven I/O External asynchronous input is used to tell the processor that I/O device needs its service and hence processor does not have to check if the I/O device needs service The processor is allowed to execute its instructions in sequence and only stop to service I/O device when required. This increases system throughput Interupt must be enabled to process. Because instruction execution sequence is interrupted, it needs initialization of stack. System throughput does not depend on the number of I/O devices connected in the system Implemented using interrupt hardware support
Page 138
5.5) Summary
There are two strategies for addressing I/O devices attached to the system bus - Memory mapped IO and IO mapped IO. In this unit, three basic approaches to I/O transfers have been introduced. The simplest technique is programmed I/O, in which the processor performs all the necessary control functions under direct control of program instructions. The next technique is based on the use of interrupts, it makes it possible to interrupt normal execution of programs in order to service higher- priority requests that require more urgent attention. When interrupt is signaled, processor executes a routine called an interrupt handler to deal with the interrupt. The third I/O scheme involves Direct Memory Access, the DMA controller transfers data between an I/O device and the main memory without continuous processor intervention. Access to memory is shared between the DMA controller and the processor. In most systems the Processor, memory and I/O devices are connected through one or more data paths known as buses.
Page 139
5.8) Assignments
Find the specifications of DMA controller used in the recent processors.
5.11) Keywords
Memory mapped I/O, I/O mapped I/O, Programmed I/O, Interrupt driven I/O, DMA
Page 140