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

  • 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. – mosvy Jul 11 '19 at 4:59
  • Thanks @mosvy - if these kernel-mode ttys (/dev/tty*) aren't used for anything useful, why do they still exist today? – Shuzheng Jul 11 '19 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. – mosvy Jul 11 '19 at 5:08
  • Userspace terminal emulator don't rely on /dev/ttyX functionality, but pty functionality. – 炸鱼薯条德里克 Jul 11 '19 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"? – Shuzheng Jul 11 '19 at 7:59

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.

| improve this answer | |
  • Thanks! Is there any reason why all terminal emulation is not moved into userland (PTYs)? – Shuzheng Jul 11 '19 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? – Shuzheng Jul 11 '19 at 5:06
  • 1
    @Shuzheng there are no /dev/ttyN devices on my router or phone (both running Linux). – mosvy Jul 11 '19 at 5:12
  • @Shuzheng you may be interested in reading mail-archive.com/dri-devel@lists.freedesktop.org/msg156108.html – sourcejedi Jul 11 '19 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.