
Ask HN: What renders the terminal/shell? - nebabyte
Hi HN, I am trying to gain an &quot;exact process&quot; understanding (similar to the detailed step-by-step analyses of &quot;what exactly happens when you type in a command or a URL and hit enter&quot; in CS instruction) of what forms a terminal&#x2F;shell&#x2F;&quot;command prompt&quot;.<p>I believe I grasp the basics of windowing systems and TTY emulation, but I&#x27;m stuck on rendering.<p>What do I search for to figure out what exactly the characters-to-be-printed are handed off to on an OS - it wouldn&#x27;t be the windowing system itself, would it? Is there some intermediary program or process that derives rendering logic for the characters (line wrapping and so forth) to be passed on as a window canvas?<p>Thanks for any help.
======
schoen
This is different if you're talking about a console or a terminal emulator (in
a windowing system).

In a console you might have a console driver, while in a windowing system you
might have a text renderer. The text renderer can be a library that is still
above the level of the windowing system, or in some windowing systems it can
be a functionality provided by the windowing system itself.

For an example, see [http://www.pango.org/](http://www.pango.org/). (But note
that there are other options for handling this layering. There is no principle
of operating system design that says that this task absolutely has to be
handled at one particular layer or another.)

------
nandemo
You might want to read "The TTY demystified":
[http://www.linusakesson.net/programming/tty/index.php](http://www.linusakesson.net/programming/tty/index.php)

If you're on Linux and using a text console (Ctrl-Alt-F1 etc), IIRC the
characters are rendered by the VGA card.

If you're using a terminal emulator like xterm or iTerm, it's different, but I
don't know the answer.

------
wmf
It's called a terminal emulator or just terminal. Examples include xterm,
rxvt, gnome-terminal, st (supposedly non-crufty but probably full of crackpot
stuff), kmscon (takes over the whole screen instead of using a window system),
alacritty (super fast because Rust).

~~~
littlestymaar
> alacritty (super fast because Rust)

Super fast because of GPU-acceleration would be more realistic.

