top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

If i write exit() in child process then what happens to the main parent process?

+2 votes
399 views

Same question for Thread also..
If i use exit system call in thread then what happens to the main process?

posted Mar 23, 2015 by Chirag Gangdev

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

If child process exits then there is no impact on the parent and if parent exits then child process becomes 'orphaned' (i.e. its parent becomes init - PID 1).

In case of thread their is no parent child relationship for example if thread A creates thread B and then thread A terminates, then thread B will continue to execute. [The exception to this is when the main thread (that is, the thread that runs the main() function) terminates. When this happens, the process terminates and all other threads stop.]

answer Mar 23, 2015 by Salil Agrawal
Thats right sir.. but my qustion is if i use exit() system call in child process then it will come out only from child process or from main process also?
only child process :)
Similar Questions
+4 votes

When a process is created using vfork() child process is created and starts running in the parent process address space, until exit() or exec() is called.

What happens to the parent process, if some one kills the child process before calling the exit()/exec()?

+1 vote

I monitor number of crond processes on my machines. On one of them I have 2 crond processes for a short period of time (few minutes) everyday. It is at the same time when one jobs starts to run - a sphinx indexer.

What are the possible causes of crond running a child crond process?

+2 votes

I have one parent "quote__c" and child object "Quote_line_item__c" .I want get the parent id with query some thing like this

select id,(select name from quote_line_item__c where name='123' and name='456') from quote__c
...