1.

Which system call is used to run a new program?(a) fork(b) wait(c) exec(d) exitThe question was asked at a job interview.My doubt stems from Process Status:ps Command and Phases of a Process in section The Process of Unix

Answer»

Correct choice is (c) exec

The best I can explain: Forking CREATES a new PROCESS but it is not ENOUGH to RUN a new program. To do so, the forked child needs to overwrite its own images with the code and data of the new program. This mechanism is called exec and the child process is SAID to exec a new program.



Discussion

No Comment Found

Related InterviewSolutions