Input Output Management
Input Output Procedure
A computer system uses a device controller to facilitate the transfer of
information between the device and the CPU. A complex controller like small
computer system interface (SCSI) may permit connecting several I/O devices
simultaneously.
Buffer Basic Concept
A link has some capacity that determines the number of message that can reside
in it temporarily. This property can be viewed as a queue of message attached to
the link. Basically, there are three ways that such a queue can be implemented:
§ Zero capacity: The queue has maximum length 0; thus the link cannot have any message in it. In this case the sender must wait until the recipient receives the message. The processes must be synchronized for 0a1 message. The two processes must be synchronized for a message transfer to take place. This synchronization is called a rendezvous.
§ Bounded capacity: The queue has finite length n, thus at most n message can reside in it. If the queue is not full when a new message is sent, the latter is placed in the queue (either the message is copied or a pointer to the message is kept), and the sender can continue execution without waiting. The link has a finite capacity, however. If the link is full, the sender must be delayed until space is available in the queue.
§ Unbounded capacity: The queue has potentially infinite, thus any number of message can wait in it. The sender is never delayed.
Single Buffer
The simplest time of support that the operating system can provide is single
buffering. When a user process issues an I/O request the operating system assign
a buffer in the system portion of main memory to the operation.
For block oriented devices, the single buffering scheme can be described as
follows. Input transfers are made to the system buffer. When the transfer is
complete, the process moves the block into users space and immediately request
another block. This is called reading ahead, or anticipated 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 at the end of
a sequence of processing will a block be read in unnecessarily.
Double Buffer
An improvement over single buffering can be had by assigning to system buffer
to the operation. A process now transfer data to (or from) one buffer while the
operating system empties (or fills) the other. This techniques is known as double
buffering or buffer swapping. For block oriented transfer we can roughly estimate the transfer time as max[C,T]. It is therefore possible to keep the block oriented device going at full
speed if C< T. On the other hand, if C>T, double buffering ensures the process
will not have to wait for I/O. In either case, an improvement over single
buffering is achieved. Again, this improvement comes at the cost of increase
complexity.
Spooling Technique
Spooling is a way of dealing with dedicated I/O devices in a multiprogramming
system. Consider a typical spooled device: the line printer. Although it would be
technically easy to let any user process open the character special file for the
printer, suppose a process opened it and then did nothing hours. No other
process could print anything.
Instead what is done to create a special process, called a daemon and a special
directory, called a spooling directory. To print a file, a process first generate the
entire file to be printed and puts it in the spooling directory. It is up to the
daemon, which is the only process having permission to used the printer’s
special file, to print the files in the directory. By protecting the special file,
against direct use by users, the problem of having someone keeping it open
unnecessarily long is eliminated.
Spooling is not only use for printers it is also used in other situation. For
example, file transfer over a network often uses a network daemon. To send a
file somewhere, a user puts it in a network spooling directory. Later on, the
network daemon takes it out and transmit it. One particular use of spooled file
transmission is the USENET network, which is primarily used an electronic mail
system. This network consists of thousand of machine around the world
communicating by dial up telephone lines and many computer networks.
No comments:
Post a Comment