session

~/chopper

article

Kernel terminal devices

Kernel creates terminal devices when the system boots, typically located at the /dev folder of the home. There are multiple kinds of devices, mainly virtual consoles like /dev/tty* and pseudo terminal devices located at /dev/pts/*. Virtual consoles are text-based terminal devices and programs like getty are attached to it. Getty is a program that handles login and shell programs to start.

Graphical User Interface (GUI) of the operating system is created by display server such as Wayland. Display server uses one virtual console to handle I/O operations. Terminal emulators like Warp(Terminal) and GNOME Terminal are GUI apps.

Virtual console provides only one full-screen terminal session so that pseudo terminal devices are needed to provide multiple terminal sessions. One pseudo terminal device can handle multiple terminal sessions. It comes as a pair, master and slave. Master PTY is controlled by terminal emulators and it sends I/O signals to the Slave PTY. Slave PTY which shell programs attached to also handle I/O signals and send back to the Master PTY.