How does fork() return for child process

Posted by EpsilonVector on Stack Overflow See other posts from Stack Overflow or by EpsilonVector
Published on 2010-04-01T18:15:53Z Indexed on 2010/04/01 18:33 UTC
Read the original article Hit count: 515

Filed under:
|

I know that fork() returns differently for the son and father processes, but I'm unable to find information on how this happens. How does the son process receive the return value 0 from fork? And what is the difference in regards to the call stack? As I understand it, for the father it goes something like this:

father process--invokes fork-->system_call--calls fork-->fork executes--returns to-->system_call--returns to-->father process.

What happens in the son side?

© Stack Overflow or respective owner

Related posts about linux

Related posts about fork