Journal nocomment's Journal: Wow, Google is mentally draining 5
I had a phone interview today with Google. They sure ask a lot of strange questions. They sure know how to make a competent guy feel dumb though.
I'm not sure if the questions are bogus or not, or if they really expect their linux admins to know.
They were aking things like
-what system calls does ls make
-how does the kernel know to fork ls
-how does ls get it's pid
-how does test return true or false
-does ls return true or false
-would there be any limitation to using a million chained network switches
And various other really bizarre questions.
All this but then they seemed surprised that you can use php for shell scripts.
I think they were just trying to shake me up, and it worked. Anyone else aware of what system calls ls makes?
Re: (Score:1)
Re: (Score:3, Informative)
ls: typically, open() then getdents() to get the list of filenames (unless they're passed on the command line: remember, in Unix the shell does wildcard expansion for you), sometimes lstat() to get the permissions, size, ownership and nature of each file (if you're using -l, --color or anything similar) - and, of course, write() (or possibly writev()) to feed the resulting text to stdout. Probably also sbrk() at some point to get a bit of memory to work with, or possible mmap() instead.
How does the kernel
Re: (Score:1)
Re: (Score:2)
Nope - if your shell did that, it wouldn't come back! Remember, a successful execve() call never returns: it replaces the calling process with the target. I suspect you straced 'bash -c ls', which tells bash to execute ls then exit; in that case, since bash doesn't need to stick around,
Re: (Score:1)