You’re in a tiny room at Googamazbook and the interviewer comes in, says hi (if you’re lucky), presents themselves (they’re really into doing you a favor) and then starts asking questions. The easy one comes first:
What happens when you run telnet www.brainware.ro 80 ? Please go on through all the layers.
Warmed up from the systems interview, you start talking about /etc/hosts and /etc/resolv.conf: name resolution and then the actual connection to the http port. If your knowledge stops here, please do go on reading this text. Or just do go on, maybe I forgot something.
1. Name Resolution
The name resolution protocol is performed by sending an UDP packet to each resolver found in /etc/resolv.conf. The UDP packet has a small header containing:
Note: The first 3 episodes of the interview series can be found here, here and here.
Question 1:
You have the shared document open and the phone rings. The interviewer, at the other end of the line, starts with a thick accent:
– What does ls * do?
You cannot believe your ears: it sounds easy. Really easy. So you answer in the line of “it lists all the files in the current directory”. The interviewer follows up with one or 2 questions on how it really works and you answer about the star being passed as a parameter to ls and how the binary interprets it in some way that it gets the entire directory walked over and its contents listed. Simple!
Note: this text is about Systems Programming on Linux platforms.
This type of interview is focused on finding out what do you know about what happens below the “command line” surface. Down there things can get messier, as processes get created, terminated, the output gets collected, system calls are performed. Things get complicated really fast for the unaware or the unprepared.
Let’s take for example a single command that is being run:
$ ls
This is a classical interview question, asked for more than 15 years now. I’m not sure if anyone still asks it in 2016, but it’s still interesting to see the answer. So, what happens when this is being run? (No, not the file list display).
From the beginning: