Unix Programming - waiting for all process in a session

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2006 > waiting for all process in a session





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author waiting for all process in a session
pankajtakawale

2006-07-20, 1:23 pm

I have a process which is session leader and have controlling terminals
attached to it. It forks other process, which in-turn forks
grand-children. Children dies quickly and init adopts grand-children.
But still grand-children belongs to my process's session.

waitpid with pid 0, doesnt wait for grand-children, as it belongs to
init's process group.

Is there any mechanism/way to wait for all the process in same session?

Chuck Dillon

2006-07-20, 1:23 pm

pankajtakawale wrote:

> I have a process which is session leader and have controlling terminals
> attached to it. It forks other process, which in-turn forks
> grand-children. Children dies quickly and init adopts grand-children.
> But still grand-children belongs to my process's session.
>
> waitpid with pid 0, doesnt wait for grand-children, as it belongs to
> init's process group.
>
> Is there any mechanism/way to wait for all the process in same session?
>


If the orphaned processes haven't been reaped by init they haven't
exited. They must be hung in some way. It sounds like you need to
look at how these grand-children are cleaning up and exiting. Can you
run strace or truss on them and see what they are doing?

-- ced

--
Chuck Dillon
Manager of Software Development, Bioinformatics
NimbleGen Systems Inc.
pankajtakawale

2006-07-20, 7:24 pm


Chuck Dillon wrote:
> pankajtakawale wrote:
>
>
> If the orphaned processes haven't been reaped by init they haven't
> exited. They must be hung in some way. It sounds like you need to
> look at how these grand-children are cleaning up and exiting. Can you
> run strace or truss on them and see what they are doing?
>


Right, my grand-children process is executing while(1) sleep(2);
I've written this as a sample example.
I want my process (which is session leaders & have controlling terminal
attached) to wait for all the process in its session. When all the
process in a session are stopped then and only then I want my
Parent-process go away.

> -- ced
>
> --
> Chuck Dillon
> Manager of Software Development, Bioinformatics
> NimbleGen Systems Inc.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com