In a diagram from APUE,

  • Where is a physical terminal device or virtual console for the terminal emulator read and write with?

  • what process open, read and write with some physical terminal device or virtual console? Is it the terminal emulator?

enter image description here


See What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)? for lots of useful context.

The point of a terminal emulator is to emulate the physical terminals of old. None of the connections in the APUE diagram correspond to anything physical. When it starts a shell, the terminal emulator opens the PTY master, allocates a PTY slave, sets the appropriate line discipline (if necessary), and execs the shell with the corresponding file descriptors as standard input etc. The terminal emulator’s job then consists of emulating the behaviour of a physical terminal, implementing the display (typically using X or Wayland), and the user input (ditto).

  • Thanks. Where should a physical terminal be added to the diagram? Does a physical terminal hide behind the window manager, and communicate with the terminal emulator via the window manager?
    – Tim
    Jun 2 '18 at 13:25
  • A physical terminal wouldn’t be added to this diagram. See chapter 18 and figure 18.2 in APUE for physical terminals. Jun 2 '18 at 13:35
  • Thanks. In this scenario, what process opens, reads and writes with the device file of a physical terminal device or virtual console? Is it the terminal emulator?
    – Tim
    Jun 2 '18 at 13:37
  • When you have a physical terminal, there is no terminal emulator because there’s nothing to emulate — you have the physical device. The same applies to virtual consoles. The terminal is typically managed by the init process with the help of getty. Jun 2 '18 at 13:43
  • Does the terminal emulator have file descriptors to the physical terminal or virtual console? If yes, by inheriting them from getty?
    – Tim
    Jun 2 '18 at 13:51

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.