3

I'm reading The TTY demystified, trying to get some understanding about tty, pty.

After reading the first half. I'm not getting the complete picture of how the whole thing is working when I'm type some commands into an xterm or ssh.

Below is the picture visualizing my understanding, I don't know if it's correct or not, please help verify.

  • when I type a command on the keyboard
    keyboard ->tty->xterm->pty(master)->pty(slave)->user processes
    (the purple line)

  • when a user process generates some output
    user processes->pty(slave)->pty(master)->xterm->tty->display
    (the blue line)

enter image description here

Aaron Shen
  • 8,124
  • 10
  • 44
  • 86

1 Answers1

0

The diagram seems confused with regard to the box for "tty":

  • a pseudo-terminal has devices that might be named "tty" and "pty" (in the pre-Unix98 configuration). The /dev-entry for tty corresponds to the pseudo-terminal master.
  • xterm reads keystrokes as X events via the X server from whatever the keyboard device happens to be.
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105