Interview Question

Site Reliability Engineer Interview

-

Google

What happens when I type "ps" into a UNIX prompt?

AnswerAdd Tags

Interview Answers

4 Answers

10

Those are not the answers that they are looking for. You basically answered what happens when you turn your computer on with: "The picture appears on the monitor". A proper answer involves: shell word splitting, searching PATH, loading dynamic libs, argument parsing, syscalls, /proc. If you don't know what ps is doing, it isn't hard to find out.

You must do better than that simple answer.. on

0

It's a question to check if you understand behind the scenes of a terminal when a command is issued. I would answer it in that way: when I type a command and press enter, the Shell has a command line parser that checks if the text entered is a available command in the PATH or not, if not found it checks the system libs to see if it can find the definition of it, if nothing is found, it throws error ": command not found". In the successful case, where the command is found it loads the binary from the defined path and a system call is executed accordingly to fetch the process data from the OS.

Anonymous on

0

see list of all processes

Anonymous on

0

see list of all running processes

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.