Who is the parent of a killed process ?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Who is the parent of a killed process ?
# 1  
Old 05-06-2008
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
# 2  
Old 05-06-2008
init will inherit processC.
# 3  
Old 05-07-2008
Thank you, Why is init the parent?
# 4  
Old 05-07-2008
Quote:
Originally Posted by Puntino
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.
# 5  
Old 05-09-2008
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)?
# 6  
Old 05-13-2008
Quote:
Originally Posted by Puntino
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-13-2008 at 03:05 AM.. Reason: Edit.
# 7  
Old 05-13-2008
If the parent installed a signal handler for SIGCLD, it will get a signal. But the sender is the kernel, not the dead process.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to prevent process from being killed

Hi,all.Well,I know someone has already asked this question before,however,It's too long before.So i post a new thread here. Here is the issue.I have a shell script that use awk to calculate something and the script takes about 15 mins,it will use 100% CPU,and the system automatically killed the... (2 Replies)
Discussion started by: homeboy
2 Replies

2. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

3. UNIX for Dummies Questions & Answers

Protect a Process from Being Killed

Hi, I have a process which takes 13-15 mins for execution and its getting killed in the meantime.So can you please helpme out how to protect the process from getting killed. Thanks in advance. Regards, Harika (9 Replies)
Discussion started by: harikagrp
9 Replies

4. UNIX for Dummies Questions & Answers

SAS Process Getting Killed

HI all, I am very new to AIX (matter of fact Unix). We are currently automating out manual process using Unix Shell Scripting. My wrote a shell script which will accept the name of the sas job as parameter, checks the existense of the sas file in the specified folder. If it is not present,... (1 Reply)
Discussion started by: anubhav2020
1 Replies

5. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

6. Shell Programming and Scripting

Running at command - Parent script getting killed

I have a script that calls another script within it that takes about 1 hour to execute. I am noticing that the parent script that calls the child script is getting killed. Does anyone know why? The child script still runs. (3 Replies)
Discussion started by: 3junior
3 Replies

7. Solaris

LDAP process getting killed

Hi all, Currently I am using LDAP to store some network related data, When I run following script ./ns-slapd ldif2db Execution of above script terminates displaying "Killed" on the console. As far as I know, a process can be killed by two ways- 1. manually running " kill -9 <PID of LDAP... (1 Reply)
Discussion started by: akash_mahakode
1 Replies

8. Solaris

how to run a killed process

hi, i am creating a daemon process for updating the file at regular interval.one problem with this is if anybody kills the daemon it wont update the file.anybody have idea how to rerun the daemon if it killed.the code is written in c++ in solaries environment. thnaks & regards suresh (8 Replies)
Discussion started by: suresh_rtp
8 Replies

9. Programming

Status of child job after parent is killed

Hi, I have a requirement. Scenario: A parent job invokes a child job and gets killed. The child becomes orphan and gets attached to init. Child job is removed from the pid table as soon as it gets completed. Requirement is i need the status of the child job even after the parent job is... (7 Replies)
Discussion started by: anjul_thegreat
7 Replies

10. UNIX for Dummies Questions & Answers

process not getting killed

I have a process that is in the sleeping state "S" and I have tried to stop it with a run control script that I use to stop/start it - but it does not stop. I have tried kill -9 <PID of process> with no change. I imagine that this process is sleeping with the kernel. It does not respond to... (5 Replies)
Discussion started by: finster
5 Replies
Login or Register to Ask a Question