Ask HN: What renders the terminal/shell?

3 points by nebabyte ↗ HN
Hi HN, I am trying to gain an "exact process" understanding (similar to the detailed step-by-step analyses of "what exactly happens when you type in a command or a URL and hit enter" in CS instruction) of what forms a terminal/shell/"command prompt".

I believe I grasp the basics of windowing systems and TTY emulation, but I'm stuck on rendering.

What do I search for to figure out what exactly the characters-to-be-printed are handed off to on an OS - it wouldn'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?

Thanks for any help.

4 comments

[ 2.9 ms ] story [ 17.4 ms ] thread
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/. (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.)

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).
> alacritty (super fast because Rust)

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

You might want to read "The TTY demystified": 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.