13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Device drivers 163counter.) These counters can be used by the programmer to determine where theprogram is spending its time.The necessary actions can often be accomplished very quickly, and context can thenswitch back to the interrupted process.3.3 Terminal device driversThe Beautification Principle applies to both the process interface and the user interface.The user interface is heavily influenced by the device driver for the terminal. When theuser types a key on the keyboard, the lower part of the driver might echo the character onthe associated display device. (A terminal on a half-duplex line does not need this service.)Often a user will type ahead before any program has asked to read the information.The device driver might store a certain amount of type-ahead in a buffer so that it is notlost. Most operating systems echo typed-ahead characters as soon as they are typed, butsome, like Tenex, wait until the characters are read by some process before echoing.This latter approach has the advantage that the display is never cluttered with typedaheadcharacters. In addition, the process that wants to read the characters might notwant them echoed at all; deferring the echo lets the driver accommodate such wishes.But it is hard to type accurately if you can’t see what you are typing.Many operating systems provide editing facilities that the user can invoke before aprogram reads data that have been typed in. Mistakes can be removed by deleting oroverwriting the offending characters. Most operating systems define at least two editingcharacters, one to erase the entire line that has been typed in so far and another to erasethe last character on the line. These facilities are available until the user activates theline by pressing the carriage-return key. Special characters are reserved for editing purposes.The backspace key, which is the same as H in the ASCII character set,is quite common for erasing a single character. The U key is often used forerasing an entire line. These keys echo in such a way that the user can tell how much hasbeen erased. One convention is to repeat the character that is being erased. <strong>An</strong>other,which works only on video displays, is to erase the character from the screen. Erasure isusually performed by moving the cursor back, printing a space, and then moving the cursorback again. Erasing a tab character from the screen requires special effort, since thenumber of repetitions of this erasure sequence depends on the exact position of the characterbefore the tab.More sophisticated operating systems provide additional features, including thefollowing.Erasing one wordMoving backward or forward in the input lineDeleting or adding text at the current location in the input lineSearching for characters in the lineRecalling previous lines that have already been activated. This facility is particularlyuseful if the user types in a command to a program, but the command has an

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!