Linux TTY: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 31: Line 31:
==TTY Driver==
==TTY Driver==


 
The TTY Driver implements [[#Session_Management|session management]].


=Pseudo tty=
=Pseudo tty=

Revision as of 23:19, 2 May 2018

External

Internal

Overview

"TTY" is a Linux subsystem that provides the conduit through which keyboard strokes captured while the focus is in a terminal such as iTerm2 or xterm are turned into the right characters and delivered to UNIX processes. At the same time, the TTY subsystem funnels the process' generated output back to the terminal. The name comes from "teletype", which used to be electro-mechanical machines that read keyboard entires, turned them into electrical signals and sent them across the wire to to other teletypes.

TTY Functions

Line Editing

TTY subsystem provide line editing services, where a backspace key actually removes the last typed character from an internal editing buffer, instead of being sent to the user process. This functionality is implemented by a component known as line discipline. Line discipline also contain options for character echoing, automatic conversion between CR and LF. User processes have the choices of disabling this functionality, by putting the line discipline in "raw" mode, instead of the default "cooked" (or "canonical") mode. The kernel provides several line disciplines, but only one is attached to a given serial device at a time.

Session Management

TTY session management allows one user to interact with multiple processes running simultaneously in user space, one at a time. The TTY subsystem implements these features in the TTY driver.

Components

The TTY subsystem has several kernel components:

Line Discipline

A kernel-level component providing line editing capabilities.

TTY Driver

The TTY Driver implements session management.

Pseudo tty

With the first terminals, there was always a piece of hardware (display or serial port) attached to the device. With XWindows, telnet and ssh, there came a need for software pseudo devices to do the job of standing in for display hardware. These are the pseudo terminals, software that emulates terminal hardware, handling input and output in the same way a physical device would do.

Console