🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

chapter10.pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Transcript

I/O MANAGEMENT External devices that engage in I/O operations with the computers CPU can be groupes into three categories. 1) Human readable 2) Machine readable 3) Communication Human readable materials are produces by devices like VDU, keyboard and printers. Machine readable data are suitable for...

I/O MANAGEMENT External devices that engage in I/O operations with the computers CPU can be groupes into three categories. 1) Human readable 2) Machine readable 3) Communication Human readable materials are produces by devices like VDU, keyboard and printers. Machine readable data are suitable for communicating with electronic equipments like disks, tapes, controllers and sensors. Communication is suitable for transfering and receiving data between remote devices like modems and line drivers. Some of the devices are listed below as bps: Device (KB/s) Keyboard Scanner Voice Otput Line Printer Laser Printer Network Terminal Network LAN Optical Disk Magnetic Disk Purpose Input Input Output Output Output I/O I/O Storage Storage Partner Human Human Human Human Human Machine Machine Machine Machine Data Rate 0,01 0,02 0,06 1 100 0,05 200 500 2000 Organization Of The I/O Functions The following techniques may be used for performing I/O operations. 1) Programmed I/O The processor issues an I/O command on behalf of a process to an I/O module; the I/O module will perform the necessary action and set the appropriate switches by the necessary bits. In the I/O status register no interruption is issued by the I/O device to inform the CPU. It is the responsibility of the processor to test the availability or status of the I/O device. Here the processor is continuously kept busy to test the I/O register. 2) Interrupt Driven I/O To avoid the processor wait for the release of the I/O device, the I/O device itself sends an interrupt to the processor informing it that the job is finished, leaving the processor do other valuable work for other purposes. Data transfer will still be forwarded by the processor but the time spend in controlling the device registers is avoided. 4) Direct Memory Access (DMA) Interrupt driven I/O is although more efficient than simple programmed I/O, still requires the active intervention of the processor to transfer data between memory and I/O module. So time processor is kept busy with transfering data instead of processing instructions on behalf of users. A module called DMA may be employed to take over the load described above from the processors. The processor first issues a request for the transfer of data as a block to the DMA and is interrupted only when the entire block is transferred. The transfer of data takes place between the memory and the I/O device leaving the processor do other work. On such systems there are special instruction set governing the data transfer activities between the memory and I/O devices these instruction will interrupt the processor when the entire transfer work is finished. In advanced systems there are intelligent I/O modules, often called I/O processors. These are themselves computers in their own rights. I/O processor will take care of most of the task involved in controlling the communication between memory and I/O devices. I/O BUFFERING When processors perform I/O operations involving relatively slow devices, the portion of the process doing the I/O has to wait until the I/O operation is completed occupying processor and memory with the address location of the data to be read or written to/from the secondary storage. To avoid this inefficiency it is sometimes convenient to perform input transfers in advance of requests being made and to perform output transfers sometimes after the request is made. This technique is known as buffering. As far as the buffering is concerned there are two groups of I/O devices. Block-oriented devices, generally secondary storage, disk and tapes where data are stored as blocks and referenced by their block numbers. Stream-oriented devices, terminals, printers, communication ports, mouse and other pointing devices will use variable size stream of data to perform different tasks. SINGLE BUFFER The simplest type of support that the O.S. can provide is single buffering. When a user process issues an I/O request, the operating system assigns a buffer in the system portion of main memory to the operation. For block oriented devices the single buffer buffering scheme can be described as follows. Input transfers are made to the systems buffer. When the transfer is complete the process moves the block into user space and immediately requests another block. This is called reading ahead or antispated input. It is done in the expectation that the block will eventually be needed. For many types of computation, this is a reasonable assumption most of the time. Only the end of a sequence of processing will a block be read in unnecessarily. This approach will generally provide a speed-up compared with a system without buffering. The user process may be processing one block of data while the next block is being read in. The operating system is able to swap the process out because input operation is taking place into system memory rather than into user process memory. This technique does however complicate the logic in the operating system. The operating system must keep track of the assignment of system buffers to user processes. In block oriented I/O the single buffering will have an improved speed compared with systems without buffering. If C is the computation time and T is time to input one block, then execution time per block is T+C with no buffering. In single buffering scheme the effect of reading ahead will maximize the execution time by making the next block of data available more efficiently. Hence MAX(C,T)+M where M is the time required to move the data from the system buffer to user memory. For stream oriented I/O such as terminals and printers the buffer is filled with one line of data usually terminated with a carriage return signaling the end of stream. DOUBLE BUFFER An improvement over single buffering can be achieved by assigning two buffers to the operation. A process now transfers data from one buffer while fills the other. This technique is known as double buffering or buffer swapping. For block-oriented transfers if C<T then the processing will continue to receive data from the I/O device at full speed. If C>T, double buffering will ensure a reasonable flow of continous data to the processing activity. For line or byte oriented I/O the only advantage of double-buffer over single buffer is that it offers twice as much data, hence twice as fast supply of I/O burst handling. CIRCULAR BUFFER In systems where rapid bursts of I/O are expected then double-buffer may be inadequate (not enough). More than two buffers may be used to ensure a smooth flow of data through I/O devices. The collection of buffers will house more data which will minimize the waiting time of processes because of slow moving I/O devices.

Tags

computer science input output data transfer
Use Quizgecko on...
Browser
Browser