LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   about return value in fork system call (https://www.linuxquestions.org/questions/linux-newbie-8/about-return-value-in-fork-system-call-4175472193/)

sur875 08-05-2013 10:55 AM

about return value in fork system call
 
a process runs(using fork system calls),it returns 2 values..how this is possible?

linosaurusroot 08-05-2013 11:06 AM

It's like if you break a magnet in half you don't get separate N and S poles - you get 2 magnets. fork() is supposed to work like that otherwise your processes would lose their sense of direction.

What did you expect?

salsalinux 08-05-2013 11:08 AM

Well, if the process Forks, then it is a process and a child process, each requiring an end before returning control to the OS. So that is probably the 2 returns, the parent return, and child return.

What is the program you are running? Or did you program it yourself? Maybe we can test it on another Linux system and see if we get the same results.


All times are GMT -5. The time now is 09:46 PM.