0

Having read this canonical article on TTYs, I'm not sure when kernel-mode TTY emulation (Linux console) is used instead of user-mode TTY emulation (e.g. xterm).

Normally, I'm always using gnome-terminal, xterm, or some other user-mode TTY emulation, so how does kernel-mode TTY emulation fit into this picture? Is Linux console the first TTY that is started, which allows the user to subsequently run e.g. xterm?

Kernel-mode terminal emulation: enter image description here

User-mode terminal emulation (PTY):

enter image description here

7
  • The kernel mode tty emulation (virtual tty) is only used for the "black" terminals (either vga or frame buffer) that you can access with ctrl-alt-f1, ctrl-alt-f2, etc. They don't even exist on many platforms (neither my router nor my phone has anything like that). Neither pseudo-ttys (as used by xterm, gnome-terminal, ssh, etc) nor actual serial ttys have anything to do with them. Commented Jul 11, 2019 at 4:59
  • Thanks @mosvy - if these kernel-mode ttys (/dev/tty*) aren't used for anything useful, why do they still exist today? Commented Jul 11, 2019 at 5:04
  • They are useful. They allow you to use linux on a PC-like machine with keyboard and screen without having to install any extra software or use another machine from which to connect via a serial link or network connection. Commented Jul 11, 2019 at 5:08
  • Userspace terminal emulator don't rely on /dev/ttyX functionality, but pty functionality. Commented Jul 11, 2019 at 5:12
  • @mosvy - aren't all terminals (tty or pty-based) associated to vga? They are all rendered on the monitor. Or what do you mean by "either vga or frame buffer"? Commented Jul 11, 2019 at 7:59

1 Answer 1

2

Kernel-mode TTY emulation is the /dev/tty* devices that don't involve any X/Wayland programs at all. You use them by pressing Ctrl+Alt+F2 or similar. User-mode TTY emulation is basically anything else that gives you a terminal, and are the /dev/pts/* devices. They're what's created by gnome-terminal, sshd, screen, and basically everything else.

4
  • Thanks! Is there any reason why all terminal emulation is not moved into userland (PTYs)? Commented Jul 11, 2019 at 5:02
  • @mosvy mentions that kernel-mode tty emulation is only used for "black" terminals that don't exist on many platforms. Why do we see them in /dev/tty* then? Commented Jul 11, 2019 at 5:06
  • 1
    @Shuzheng there are no /dev/ttyN devices on my router or phone (both running Linux). Commented Jul 11, 2019 at 5:12
  • @Shuzheng you may be interested in reading mail-archive.com/[email protected]/msg156108.html Commented Jul 11, 2019 at 8:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.