-   Linux - Newbie (
-   -   about return value in fork system call (

sur875 08-05-2013 10:55 AM

about return value in fork system call
a process runs(using fork system calls),it returns 2 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 07:33 PM.