Bloomberg LP Interview Question
Financial Software Developerssure.. here's the outline:
- Shell fork()'s and the child process exec()'s the image of the command (gcc in this case).
- The shell does not call wait() or waitpid(), because that would cause the command to run in foreground and shell prompt won't return until child is finished.
- So what shell does is install signal handler for SIGCHILD signal. When the child finishes, the kernel sends SIGCHILD signal to parent (the shell in this case), and shell calls the signal handler. In the signal handler, shell calls wait() or waitpid(), which reads the return value of the child process (so that child process does not become a zombie).
Voila!
@callbacker..If u know the answer can you please explain the sequence of steps in detail? That would be really helpful..
- KingKong.. June 25, 2010