Analysis on tty, pty, and pts

Source: Internet
Author: User

Analysis on tty, pty, and pts

First, let's start with the concept. The so-called tty is the abbreviation of TeletypeWriter. Its Chinese translation is a telex typewriter. Its main function is to print and read information, later, it was replaced by a keyboard and a display. However, tty's common understanding is terminal.

What is a terminal? It is an electronic or electromechanical hardware device that can be used to input data to a large host and display data from the host. In the early days of computers, many computers connect to several terminal consoles. The hardware structure of these terminals is very simple. They do not execute computing tasks. They are only responsible for Inputting User commands, and return the computation results.

Our telex typewriter can be understood as the earliest computer terminal. Of course, with the keyboard, mouse, and display, this is history. At this time, the concept of the terminal has also changed slightly, because a previous device can complete two functions, but now it is divided into two devices, that is, the current display no longer contains the character generation function.

Later, we introduced the virtual terminal function, which is pty. It is short for the pseudo-Do tty, which is also called a pseudo Terminal, for example, remote telnet can be considered as a Pseudo Terminal.

In the process of implementing pty, we introduced two more concepts:

(1) Since we want to implement pty, some devices need to be connected. They can be understood as ptmx and can be understood as a master.

(2) When some devices need active connection, they can be understood as pts and slave.

There are two naming formats for the pty Virtual Devices:

(1) For BSD, slave generally uses the/dev/tty [p-za-e] [0-9a-f] format, the master generally uses the/dev/pty [p-za-e] [0-9a-f] format.

(2) For Unix98, slave generally uses/dev/pts/n, and the second master generally uses/dev/ptmx.

However, after X-Windows is enabled, this will happen to virtual terminals. If we use a Linux operating system, there will be virtual terminals such as pts/0.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.