Skip to main content

Standard Echo Strategy

Echoing for locally connected full-duplex terminals is normally provided at the server by a resident system task called the (e.g.) Terminal Handler. The Terminal Handler echoes on a one-for-one or simple replacement basis and buffers all typed input on behalf of the user process.

To let the user process operate most efficiently, the Terminal Handler should collect characters until a complete command or parameter (or whatever) has been typed. Then, presumably, the process can do some significant computing. Since the user process knows the syntax of the string it expects, it can specify to the Terminal Handler those characters which delimit completed parameters. Such characters are called 'Wakeup Characters' since the user process is awakened as they are echoed.

Certain commands keyed by the user will require an output response from the process. In order that the typed commands be followed by its response and be separated from succeeding commands, the Terminal Handler must suspend echoing of user type-ahead. It can resume echoing (starting for type-ahead - with the unechoed characters in the buffer) as soon as the process has stated (implicitly or explicitly) that it has completed the output response.

Characters which cause the Terminal Handler to suspend echoing are called 'break characters' They are specified by the user process based upon the syntax of the expected input. Normally break characters are also wakeup characters. As examples:

  1. A text editor may gobble up typed English sentences every time a period or question mark is echoed. The two characters are wakeup characters only. There is no need to suspend echoing.

  2. In some systems, an ESC character is used to invoke command recognition. The user who types

CO [ESC] ABC [ESC] XYZ

should see as output

COPY (FROM FILE) ABC (TO FILE) XYZ

The ESC is both a break and a wakeup. The printout should be the same no matter how fast the user types.

The server must provide a means for each user process to communicate the following to the Terminal Handler:

  1. the set of wakeup characters,
  2. the set of break characters,
  3. which break characters should and which should not be echoed, (Some break characters - such as ESC in example 2 - should not be echoed).
  4. completion of an output response,
  5. whether or not to echo characters. (Not echoing is useful in "hide your input" applications.)

As far as implementation, 1. and 2. could be communicated by allowing the user process to specify a 128-bit (for an ASCII device) table with 1's set for each wakeup character, and another table with 1's set for each break character. This approach becomes fairly expensive in terms of core memory as the number of terminals becomes large; the system must store these bit tables itself since in most cases the user process will not be in core while echoing is being done by the Terminal Handler.

To reduce the storage requirements, the system can make known to all its programmers a limited number, say 4, of supported break characters for his process from, for example:

  • a. alphanumeric characters,
  • b. punctuation characters,
  • c. echoable control characters (including the bell and CR, etc.), or
  • d. non-echoable control characters (Control-C, etc.),

by specifying in a system call which break set(s) should be used. This requires no more than 4 bits of system storage per terminal, and a single table to identify the set(s) to which each of the 128 possible ASCII characters belongs.

For the user process to communicate (3) to the Terminal Handler (which break characters should and which should not have echoed), the process can specify another 4 bit field with 1's set for those break classes whose members should be echoed. For the 4 classes above, only 3 bits would be required since members of class (d) are defined to be non-echoable.

To communicate the completion of an output response (4), the user process could issue an explicit system call; or, the Terminal Handler could assume completion when the user process requests input of the first character following the break.

"Hide your input" (5) would be communicated by a system call which specifies either:

  • (a) "break on every character and don't echo any break characters", or, for example
  • (b) "don't echo anything and break on punctuation, or any control character" for an alphanumeric password,

depending on the syntax of the expression to be hidden.