Managing TTY in the kernel with SLIP
We're not going to see any kernel code; let's see a nice kernel trick to use a serial communication line like it was an Ethernet cable! This can be done if we abstract the serial port as an Ethernet interface, that is, by defining a special Ethernet device that will use a serial cable to send and receive its data. This communication is done using the SLIP protocol.
The Serial Line Internet Protocol (SLIP) is an encapsulation of the Internet protocol designed to work over serial ports. Even if largely replaced by the Point-to-Point Protocol (PPP), which is better engineered, SLIP is still the preferred way of encapsulating IP packets due to its very small overhead and simple implementation.