The TTY subsystem contains the TTY driver, line discipline(s) and hardware drivers (keyboard driver, display driver). Let's say I use a virtual terminal/console. So, my current session uses /dev/tty1
(TTY device 1). When I press Ctrl+Alt+F2, I open another session which now uses /dev/tty2
(TTY device 2).
So, who controls which /dev/ttyN
is the active one?
Line discipline?
How about output from inactive /dev/ttyN
?
Input from process attached to it cannot be output to line discipline
because it is an inactive tty. So, input from process will just be dropped?