20

Interviewer: Yeah so we're hiring you as the person who would build out and own our client-facing web application and related stack.

Dev: Perfect, that's what I've been doing for the past 10 years, I'm your guy.

Interviewer: GREAT SO WHAT IS THE DIFFERENCE BETWEEN FORK AND EXEC ON A PROCESS ON A LINUX MACHINE!?!?!?!?

Dev: I don't... know immediately at this moment?

Dev: Sigh

Dev: I hate my life

Dev: Somebody please help me

Comments
  • 13
    Potential answer: I'd need to look that up since I never needed it in 10 years of web dev.
  • 4
    Make the interview as short as possible, and go to the next one.
    If they want to continue with you, repectfully decline.

    And the answer is - they are are similar: they both create a new process with a new PID, with the fork/exec calling process as the parent. The difference is that the exec starts up a completly new binary, and allows for communication with it via stdin, while fork duplicate the state of the parent, and continues execution from the fork statement.
  • 7
    @magicMirror The question may not be intended to get an actual answer, just for checking the reaction to a question that the applicant isn't even supposed to handle.

    It does happen in practice that you get questions e.g. from the customer, and you can't answer right away. You don't want your dev to say "I have no idea", but rather some sort of "I'll take note and get back to you later."
  • 0
    fork(): Make a clone of the current process. To be more specific: A clone with the least amount of shared memory. On Linux, the clone() syscall is also used for clones with more shared memory, aka threads.

    exec(): Replace the current process with one that runs a (different*) executable.

    *You can exec() the same executable as the current process, similar how you can run bash inside bash.

    That isn't that hard.
  • 0
    @Fast-Nop But you should understand some basics of the underlying layers. Similar how you as a software developer should be able to tell what logic gates are, how you can combine transistors to make them and how you can combine logic gates to build a very simple processor. Not that i ever needed that, but as a professional you have to know the basics of your platform.
  • 0
    @happygimp0 It's neither "hard" to see why the transfer function of stable systems has only poles in the left half of the s-plane.

    The point is that it's that it's unrelated to making client-facing web apps.
  • 2
    @happygimp0 You may need to know what processes are in general, but not how to launch them on specific operating systems. Windows for example doesn't even have fork/exec.

    Today's tech stacks are so complex that you can't expect detailed knowledge that are completely irrelevant to the scope of work.
  • 0
    @Fast-Nop You server probably runs on Linux, so yes, he should know this things.

    "Today's tech stacks are so complex that you can't expect detailed knowledge that are completely irrelevant to the scope of work."

    The complexity is a huge problem. If you don't understand the fundamentals you are not suited for the task, an no this is not irrelevant. Your software wouldn't work without the underlying operating system, so you need a general idea about the OS, syscalls, processes and so on. This is just a one layer down the stack, he didn't ask about how CPUs works, about Verilog, about gates, transistors nor the principle of semiconductors.

    Look how bad, big, slow and insecure web software has become, this wouldn't be the case if developer would understand their basics.
  • 3
    @happygimp0 Just because the web application runs on Linux doesn't mean the dev needs OS specific low level knowledge how to start processes.

    The bloat of modern websites has nothing to do with OS level knowledge and would already be massively improved if web devs saved images in proper formats and didn't scale huge images down in the browser - something that is totally within their scope of work.

    Also, websites usually aren't hacked at server level, something that isn't even the scope of the web dev, but the admin. Instead, it's rather at web application level itself, such as lousy WP installations - and that's within the scope of a web dev.
  • 1
    @Fast-Nop > "Just because the web application runs on Linux doesn't mean the dev needs OS specific low level knowledge how to start processes."

    Reminds me of when we were researching TypeScript and the web devs were strutting their elitism about how I had to learn+know all the peculiarities of Javascript before I could write a "Hello World" app in Angular/Typescript.

    Getting the same kind of elitist push back with Blazor right now. Its not Javascript...Blazor is a failure..etc..etc...etc
  • 0
    @Fast-Nop This is not low level. Something like fork+exec is absolute basics. Low level would be something like: "what is the difference between execv, execve and execvp". It is like a car mechanics that doesn't know how a Otto engine works.

    The bloat has noting to do with images but with bloated JavaScript.
  • 5
    @happygimp0 There is no need for fork/exec knowledge in a web app because JS is mostly single-thread anyway. The exception are web workers, and a web dev should know about that, but they aren't fork/exec.

    Like it or not, but the specialisation has reached a level where people don't have C/C++ under the belt when they do web programming because if they did, they'd be at a disadvantage competing against others who instead have invested that time in anything even remotely web related.

    Also, JavaScript is a major bloat contributor, but none that fork/exec knowledge would address in any way (HTML/CSS knowledge might, however), and images still contribute much more to page weight.
  • 3
    That’s useless trivia unless you’re going into a hardcore linux role
  • 4
    @happygimp0 > "It is like a car mechanics that doesn't know how a Otto engine works"

    Its more like my mom doesn't need to know how to rebuild a carburetor in order to drive me to little league practice.

    Web development is already N layers abstracted away from the OS. If a dev's Javascript code is so crappy they feel as if they need to troubleshoot the OS's Kernel ("Is it running Fork()?...ohhh snap!...That's the problem!"), then they need to re-think their career choice.
  • 3
    You guys are all missing the point. The point is I was prepared for web / frontend questions, not system level Linux questions. Obviously I can look it up and learn the answer afterword 🙄
  • 3
    @fullstackchris > "You guys are all missing the point."

    I get it. I also know I'm doomed if I ever have to look for a job. My interview answers will include any/all of the following:

    "I don't know"

    "I don't care"

    "If I need to know that information, I would look it up"

    "Good Lord that's a stupid question"

    "My social justice score? What the <bleep> is that?"
  • 0
    @happygimp0 it is something low level. It is something of inner workings of http servers and worker pool. Not near the protocol and application implementation or its maintenance.
  • 0
    @PaperTrail I love that list. Highly reasonable.

    P.S. i still don't care what a social justice score is.
Add Comment