Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What causes an orphan Unix Process?

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
0
0
US
I understand that an orphan Unix process is one whose parent has terminated, and hence has left the child process without a parent.

Also that orphan processes don't become zombie processes and a) that they are adopted by init (typically process ID 1, which waits on its children, and b) they typically will affect system performance adversely as they may spin and use up resources.

but what is a concrete example of such an event?
 
Code:
$ cat orphan
sleep 600
$ ./orphan &
[1] 18901
$ ps -f
UID        PID  PPID  C STIME TTY          TIME CMD
666      16625 16622  0 15:58 pts/3    00:00:00 -ksh
666      18901 16625  3 17:51 pts/3    00:00:00 /bin/sh ./orphan
666      18905 18901  1 17:51 pts/3    00:00:00 sleep 600
666      18906 16625  0 17:51 pts/3    00:00:00 ps -f
$ kill 18901
$ ps -f
UID        PID  PPID  C STIME TTY          TIME CMD
666      16625 16622  0 15:58 pts/3    00:00:00 -ksh
666      18905     1  0 17:51 pts/3    00:00:00 sleep 600
666      18913 16625  0 17:51 pts/3    00:00:00 ps -f
[1] + Terminated           ./orphan
$

In the above example the "sleep" process is an example of an orphan.

Annihilannic.
 
Great!

This was a great example of how to "force" an orphan.

Where do orphan comes from in day to day operations of a linux server?

-John
 
It is quite normal for many processes to be orphans, especially daemons. It really depends on the processes themselves... if you have any examples of the processes you are concerned about it would be easier to answer your question.

Annihilannic.
 
Thanks. I have no examples. That was my question. =) I am looking for some!

Thanks!
-John

 
orphan process
A orphan process is a computer process whose Parent process has finished or terminated.

A process can become orphaned during remote invocation when the client process crashes after making a request of the server.

Orphans waste server resources and can potentially leave a server spinning. However there are several solutions to the orphan process problem:

1. Extermination is the most commonly used technique; in this case the orphan process is killed.

2. Reincarnation is a technique in which machines periodically try to locate the parents of any remote computations try to find their owner; at which point orphaned processes are killed.

3. Expiration is a technique where each process is alloted a certain amount of time to finish before being killed. If need be a process may "ask" for more time to finish before the alloted time expires.

A process can also be orphaned running on the same machine as its parent process. In a UNIX-like operating system any orphaned process will be immediately adopted by the special "init" system process. This operation is called re-parenting and occurs automatically. Even though technically the process has the "init" process as its parent, it is still called an orphan process since the process which originally created it no longer exists.

This may also help


Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 
Hi This is all well and good. I have seen the wikipedia answer.

I am looking to find how, in the real world, this happens, with a concrete example. I have the *theory* down pat.


Thanks!
-John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top