Pseudoterminal
In some operating systems, including Unix and Linux, a pseudoterminal, pseudotty, or PTY is a pair of pseudo-device endpoints (files) which establish asynchronous, bidirectional communication (IPC) channel (with two ports) between two or more processes. The "master" provides means by which a terminal emulator process controls the slave. The "slave", emulates a hardware text terminal device. PTY are similar to bidirectional pipes. The "master" files are typically used by networking applications (e.g. rlogin) and "slave" files are used by terminal-oriented programs such as shells (e.g. bash) as a processes to read/write data back from/to "master  endpoint. Common application of PTYs is in providing network login services. Devpts is a Linux Kernel virtual file system used to emulate PTYs connection. Linux implementation is based on System V-style terminals (commonly referred as UNIX 98 pseudoterminals) and provides POSIX and the Single Unix Specification API in the form of a function since 1998. Unix command is typically used to get PTY file path connected to the current standard input. History. Pseudoterminals were present in the DEC PDP-6 Timesharing Monitor at least as early as 1967, and were used to implement batch processing. They are described in the 	Pseudoterminal
7775986	documentation for the succeeding TOPS-10 on the PDP-10. Other DEC operating systems also had PTYs, including RSTS/E for the PDP-11, as did the third-party TENEX operating system for the PDP-10. Unix pseudoterminals originated in 1983 during the development of Eighth Edition Unix and were based on a similar feature in TENEX. They were part of the 4.2 release of BSD, with a rather cumbersome interface defined for use. AT&T's System V included support for pseudoterminals as a driver in their STREAMS device model, along with the pseudoterminal multiplexer (). This later evolved to become the Unix98 style of 	Pseudoterminal
7775987	PTYs. Books. The Linux Programming Interface" from 2010 contains an entire chapter (chapter 64 "Pseudoterminals" p1375–1399.) explaining pseudoterminals. Then there is another one, Chapter 62 "Terminals", dedicated to terminals. The Windows Console was extended to have a PTY interface called ConPTY in 2018. Applications. The role of the terminal emulator process is: The terminal emulator process must also handle terminal control commands, e.g., for resizing the screen. Widely used terminal emulator programs include "xterm", GNOME Terminal, Konsole, and "Terminal (macOS)". Remote login handlers such as ssh and telnet servers play the same role but communicate with a remote user instead  of a local one. Also consider programs such as expect. Screen and Tmux are used to add a session context to a pseudoterminal, making for a much more robust and versatile solution. For example, each provides terminal persistence, allowing a user to disconnect from one computer and then connect later from another computer. Variants. In the BSD PTY system, the slave device file, which generally has a name of the form codice_1, supports all system calls applicable to text terminal devices. Thus it supports login sessions. The master device file, which generally has a name of the form codice_2, is  the endpoint for communication with the terminal emulator. With this naming scheme, there can be at most 256 tty pairs. Also, finding the first free pty master can be racy unless a locking scheme is adopted. For that reason, recent BSD operating systems, such as FreeBSD, implement Unix98 PTYs. BSD PTYs have been rendered obsolete by Unix98 ptys whose naming system does not limit the number of pseudo-terminals and access to which occurs without danger of race conditions. codice_3 is the "pseudo-terminal master multiplexer". Opening it returns a file descriptor of a master node and causes an associated  slave node codice_4 to be created.