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!

Script creating new processes

Status
Not open for further replies.

jones33

Programmer
Mar 20, 2007
14
0
0
GB
Hi,

I would like to check if my understanding is correct of how a single script creates new processes.

When the script starts initially it creates a new process. This is the parent process. Then as new processes are spawned within the script they will have a new PID but the PPID will be the same as the PID of the main script.

If anyone of the new processes creates a new process then the new process will have the same PPID as its parent's PID.

Therefore all processes created from within a script will have some sort of Parent\Child relationship.

Is my understanding correct?

Many Thanks
 
All correct apart from this:

jones33 said:
If anyone of the new processes creates a new process then the new process will have the same PPID as its parent's PID.

If any one of the new processes creates a new process, let's call it the grandchild of the original process, then it's PPID will be the PID of the child of the original process, e.g.

[TT]parentscript, PID 253
childprocess1, PID 254, PPID 253
grandchildprocess, PID 255, PPID 254
childprocess2, PID 256, PPID 253[/tt]

Does that make sense?

Annihilannic.
 
Actually... re-reading what you said... I think that's what you meant anyway, so you were correct in the first place :)

Annihilannic.
 
You may have a look here: faq822-4603

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top