Minggu, 12 Oktober 2014

Bahasa inggris semester tiga

3.5 I/O Channels
An I/O channel is a generalization of the DMA device. The channel can do everything that a DMA device
can do and more. The channel works like a DMA, transferring bytes one by one between the I/O device and
memory, sending and receiving the same signals, and placing the processor on hold for each byte transferred.
The main difference between the two is that a DMA device has to be programmed for each I/O transfer,
whereas an I/O channel can fetch its commands from memory. The operating system) prepares channel
commands (each one very similar to a DMA command) in response to service requests from user programs,
and stores the commands in memory. The channel reads the next command from memory, stores the
individual fields in its registers, and executes the command by performing an entire I/O transfer. It then
reads the next command from memory, executes it, and continues until no more commands are left. While
the channel executes a command, the operating system can prepare more commands and store them in
memory.
The main advantage of this type of operation is that no interrupts are necessary. When there are no more
commands in memory, the channel turns itself off (it may optionally interrupt the CPU to let the operating
system know that it is off). When the operating system prepares a new channel command in memory, it
has to check channel status to make sure the channel is still on. If the channel is off, the operating system
should start it by means of a special I/O instruction. This instruction (Start Channel) has one operand, the
address of the current channel command in memory.
I/O channels are especially suitable for multiuser computers, where several user programs are stored in
memory, waiting for execution. The processor can execute only one program at a time. When the current
program needs I/O, it places a request to the operating system by interrupting itself. The proper channel
command is prepared by the operating system and is stored in memory, and the processor is switched by the
operating system to another user program. The current program is placed off time slices. As a result, the
channel commands pending in memory may come from different user programs, and the operating system has
to (1) prepare the channel commands, (2) start the channel (or the channels), and (3) switch the processor
between user programs. The operating system of a multiuser computer is therefore much more complex that
that of a single-user computer.
Channel commands have the format shown in Figure 3.7.
The “last command” field is normally 0 and is set to 1 in the last channel command stored in memory.
Each time the operating system stores a command in memory, it sets this field to 1 and resets this field in
the preceding command.
3.6 I/O Codes 79
last
command done
interrupt
on end
goto start
address
block
size
direction
In or Out
Figure 3.7: A typical channel command
The “done” field is usually 0 and is set to 1 by the channel after it has finished executing the command.
At that point, the channel goes to memory, sets the “done” field of the command just executed, and fetches
the next one. This way, the operating system can test the channel commands in memory at any time, find
out which ones have been executed, and restart the user programs that have originally requested those I/O
transfers.
The “interrupt on end” field tells the channel whether it is supposed to interrupt the processor at the
end of the current channel command.
The ‘goto’ field is used to indicate a jump in the channel program. If there is no more room in the
current buffer for more channel commands, the last command should have just the “goto” field set, and an
address in the “start address” field. Such a command does not indicate any I/O transfer, just a jump in the
channel program to an area where more commands can be found.
The remaining fields have the same meaning as in a DMA command.
Types of channels.
There are two main types of I/O channels, a selector and a multiplexor. A selector channel is connected
to one I/O device and works as explained earlier. A multiplexor channel is connected to several devices
and works by looping over them. It may transfer a byte between device A and memory, then another byte
between device B and memory, etc.
A selector channel is suitable for a high-speed I/O device such as a disk drive. The high speed of
the device may require the entire attention of the channel. A multiplexor channel, on the other hand, is
connected to several slow devices, where it should be fast enough to match the total speed of all the devices.

3.6 I/O Codes
One of the main features of computers, a feature that makes computers extremely useful, is their ability to
deal with nonnumeric quantities. Compiling a program is an example of such a task. The compiler reads a
source program which is made up of strings of text, analyzes each string and translates it. Another example
is word processing. A word processor deals mostly with text and performs relatively few calculations.
Since the computer can only handle binary quantities, any nonnumeric items have first to be coded into
binary numbers. This is why I/O codes are so important. Any symbol that we want the computer to input,
process, and output, should have a binary code.
There are many different codes. Some are suitable for general use, others have been developed for
special applications. Some are very common, while others are rarely used. Since standards are useful in any
field, there have been several attempts to standardize I/O codes. Today, most computers use the ASCII
code (Section 3.7), more and more new computers use the new Unicode (Section 3.7), and some old IBM
computers still use the EBCDIC code. Older, obsolete second and third generation computers used other
codes.
An interesting question is: How long should the code of a character be (how many bits per character)?
The answer depends, of course, on the number of characters to be coded (the size of the character set). In
the past, computer printers were limited to just digits, upper case letters, and a few punctuation marks.
Since there are 10 digits and 26 letters (blank space is considered a punctuation mark), a character set of
size 64 was considered sufficient. Such a set can include 28 punctuation marks, in addition to the letters and
digits, and the code size is therefore six bits per character.
In the last three decades, however, printers have become much more sophisticated. In addition to the
traditional character set, common laser and inkjet printers can print lower case letters, any symbols, and
artwork. Also, advances in communications have created a need for a special group of characters, called
control characters. As a result, modern computers can handle a larger set of characters. Increasing the
code size to seven bits/character doubles the size of the character set, from 64 to 128. This is a good size,
providing codes for the 10 decimal digits, the upper- and lowercase letters, and up to 66 more characters