PDA

View Full Version : what does "child process" mean?



sanjac
23rd May 2010, 17:21
The QProcess documentation unfortunately fails to give any explanation about how a process spawned with this class behaves with respect to the spawning process, or how the two are related altogether.
Further down the page, some function descriptions refer to the spawned processes as "child processes", but the main description at the top of the page doesn't even contain this phrase.

So in what way are they "child processes"?

Specifically,

will they be listed as children of the spawning process in the operating system's task manager?
will they terminate when the spawning process terminates?
will they crash when the spawning process crashes?
is there any other significance to which process spawned which?

wysota
23rd May 2010, 17:41
will they be listed as children of the spawning process in the operating system's task manager?
Yes.

will they terminate when the spawning process terminates?
Yes.

will they crash when the spawning process crashes?
They will be terminated. At least if that's the operating system's policy but it should be that way.

is there any other significance to which process spawned which?
I don't understand what you mean.

sanjac
23rd May 2010, 21:55
will they terminate when the spawning process terminates?
Yes.

will they crash when the spawning process crashes?
They will be terminated. At least if that's the operating system's policy but it should be that way.

I see, thanks for you reply.

Is there no Qt-ish (elegant, cross-platform) way then to spawn a process which the spawning process can watch (monitor status, respawn if crashed) and communicate with (using stdio preferably), but which stays alive even after the spawning process crashes? That would be the ideal behavior for my app...

(Btw: is there an official place to let the the Qt team know that the documentation could really use some improvement regarding all of this?)

wysota
25th May 2010, 09:40
Is there no Qt-ish (elegant, cross-platform) way then to spawn a process which the spawning process can watch (monitor status, respawn if crashed) and communicate with (using stdio preferably), but which stays alive even after the spawning process crashes? That would be the ideal behavior for my app...
You can use QProcess::startDetached() to launch the process and communicate with it with a named pipe. You can probably exclude the process from the process group once it's launched using native API.


(Btw: is there an official place to let the the Qt team know that the documentation could really use some improvement regarding all of this?)
Qt has nothing to do with this. This is all OS policy that drives this behaviour. I think this is called "process group", at least in Unix world.

Tenchi
1st February 2011, 05:52
Yes.

Yes.

They will be terminated. At least if that's the operating system's policy but it should be that way.

I don't understand what you mean.

I have the opposite problem.. where my child processes do NOT terminate/crash/end when the parent crashes, and I want them to. Is there something I can do to implement this? (My Qt program is running in windows.)

Thanks,
Tenchi

ChrisW67
1st February 2011, 06:01
Start your own thread (rather than resurrecting a long dead one) with a small example program that demonstrates the problem