After finishing the Mastermind project, which was the most difficult project so far, I moved to the Files and Serialization lesson in The Odin Project curriculum.
I stumbled upon a lot of long articles full of technical language that for me, non-English native speaker were quite difficult to understand. Especially after coming back from my 9-5.
When I was reading the last one, many things clicked and I thought it all could have been explained in a little easier way. I came up with an idea of how to make it in 6 simple steps and the results are below.
This is a nice funky graph for you to visualize it:
Let’s start from the input. When you are typing something, input (IO) is taken from your keyboard and sent to TTY virtual device. TTY in Linux is the interface that handles input/output.
The input is then passed to the TTY session (the terminal interface you interact with).
From there, the TTY virtual device forwards it to the line discipline inside the kernel. Line discipline is the place where magic happens. For example, pressing BACKSPACE will clear the last character we typed in or process special keys, signals, and interpret commands.
After processing, the line discipline sends the input to the foreground process (like a shell) via STDIN.
When the process generates output, it then sends it to STDOUT or STDERR if it’s an error, which goes back through the TTY virtual device and then displays on the TTY session again.
Don’t you think these processes are really interesting? Since I started learning how to code I was always curious about how everything works under the hood. What happens when you press some buttons, what kind of signals are sent, where they are going, and so on.
Maybe in the future, I will make a similar graph to visualize something else. We will see what I will get stuck at soon.
If you have more questions, drop a comment below!
I’d love to hear what topics you’re struggling with or find intriguing. Your feedback helps me decide what to break down next. Happy learning!