The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can a child process return a specific value to a parent process ? Ametis1970 High Level Programming 8 04-09-2008 08:22 PM
kernel: Out of Memory: Killed process 2990 bsandeep_80 UNIX for Advanced & Expert Users 7 03-25-2008 11:49 AM
Status of child job after parent is killed anjul_thegreat High Level Programming 7 06-29-2007 03:36 AM
how to find the chid process id from given parent process id guhas Shell Programming and Scripting 3 10-13-2005 05:13 AM
process not getting killed finster UNIX for Dummies Questions & Answers 5 03-26-2005 09:26 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-06-2008
Registered User
 

Join Date: Apr 2008
Posts: 30
Who is the parent of a killed process ?

Suppose we have the following process tree:

init-> ProcessA->processB->processC

then I kill processB

Who is the parent of the processC?
init or the processA
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-06-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,318
init will inherit processC.
Reply With Quote
  #3 (permalink)  
Old 05-07-2008
Registered User
 

Join Date: Apr 2008
Posts: 30
Thank you, Why is init the parent?
Reply With Quote
  #4 (permalink)  
Old 05-07-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,318
Quote:
Originally Posted by Puntino View Post
Thank you, Why is init the parent?
Process A can be expected to keep track of its own children. But it has no idea how many children Process B created. If processes all must inherit grandchildren, great-grandchildren, and so on, then every process must be prepared to reap an unending number of children it knows nothing about. That's a lot to ask of every process. So we ask it only of init.

By the way, some versions of unix have a ptrace() system call intended to be only used by debuggers. Most versions of ptrace can allow a process to adopt another process and become its parent. There are restrictions on this... both processes must be owned by the same uid and the adoptee cannot be suid.
Reply With Quote
  #5 (permalink)  
Old 05-08-2008
Registered User
 

Join Date: Apr 2008
Posts: 30
many thanks Perderabo,

Another doubt that I have is: after a child exits or is killed, in my example processB, does it send a SIGCHLD to its parent (in this case processA)?
Reply With Quote
  #6 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: May 2008
Posts: 22
Quote:
Originally Posted by Puntino View Post
many thanks Perderabo,

Another doubt that I have is: after a child exits or is killed, in my example processB, does it send a SIGCHLD to its parent (in this case processA)?
Please correct me if I am wrong here.

I would guess not, otherwise we wouldn't end up with zombie processes.

Last edited by frozentin; 05-12-2008 at 11:05 PM. Reason: Edit.
Reply With Quote
  #7 (permalink)  
Old 05-13-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,318
If the parent installed a signal handler for SIGCLD, it will get a signal. But the sender is the kernel, not the dead process.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0