|
|
fork communication between parent & child
Hi,
A process forks another process and increments its(parent's) child
counter.
Only now the child knows when it's processing will be over. On childs
job completion it has to decrement the child counter held by parent.
What is the best to communicate between a parent & child process 4
synchronized update of CHILD COUNTERS.
I know it can be done via signals & IPC. I used IPC (shared mem),
because of SIGCHLD interrupt. As it was creating zombie processes.
Please put some light on this issue.
-- Pradeep Sharma
|
|
0
|
|
|
|
Reply
|
pradeep (2)
|
2/18/2005 10:37:48 AM |
|
pradeep@mauj.com wrote:
# Hi,
# A process forks another process and increments its(parent's) child
# counter.
#
# Only now the child knows when it's processing will be over. On childs
# job completion it has to decrement the child counter held by parent.
#
# What is the best to communicate between a parent & child process 4
# synchronized update of CHILD COUNTERS.
#
# I know it can be done via signals & IPC. I used IPC (shared mem),
# because of SIGCHLD interrupt. As it was creating zombie processes.
SIGCHLD tells the parent a child is waiting to return its status. The
parent still has to use one of the wait functions to get the status
and allow the child to disappear.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
One of the drawbacks of being a martyr is that you have to die.
|
|
0
|
|
|
|
Reply
|
SM
|
2/18/2005 11:19:10 AM
|
|
pradeep@mauj.com writes:
> Hi,
> A process forks another process and increments its(parent's) child
> counter.
>
> Only now the child knows when it's processing will be over. On childs
> job completion it has to decrement the child counter held by parent.
>
> What is the best to communicate between a parent & child process 4
> synchronized update of CHILD COUNTERS.
>
> I know it can be done via signals & IPC. I used IPC (shared mem),
> because of SIGCHLD interrupt. As it was creating zombie processes.
>
> Please put some light on this issue.
The parent should call wait or waitpid, and when a child termination
is reported, decrement its child counter. Note that waitpid can be
called with WNOHANG to poll.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
|
|
0
|
|
|
|
Reply
|
Pascal
|
2/18/2005 11:19:36 AM
|
|
|
2 Replies
652 Views
(page loaded in 0.062 seconds)
Similiar Articles: Parent child pipe communication scenario.. - comp.unix.programmer ...Parent child pipe communication scenario.. Follow ... child when parent exits - comp.unix.programmer ..... parent (daemon) forks few child ... fork() race in SIGCHLD handler - comp.unix.programmer... do that, because in the test code I know that the child will return before the parent fork ... One (maybe "the") standard way to synchronize between parent and child for ... how to kill all child when parent exits - comp.unix.programmer ...Guys, I am writing an application where the parent (daemon) forks few child processes. My requirement is that when the parent process exits/kil... fork (UDP) server - comp.unix.programmer... len))!= 0) { // new frame if ( !fork() ) { // Child ... exit(0); } else { // Parent process ... UDP Communication - comp.soft-sys.matlab UDP ... synchronous interprocess communication - comp.unix.programmer ...... synchronous interprocess communication ... c", which shows that the child continues before the parent ... start_child(char *child) { open_pty(); switch(fork ... EOF on pipe - comp.unix.programmerThis problem occurs on both Free BSD and Linux. I have a parent-child situation, where the parent creates two pipes, and then forks(), then the chil... Waiting for a child to die - comp.unix.programmer... printf("forking!\n"); child = fork(); if(child == 0 ... Inside child Inside Parent Calling waitpid Child exited ... SunRay Communication Issue - comp.unix.solaris ... Practice of using fork() - comp.unix.programmerAnother is that you often need to do things in-between the 'fork' and the 'exec'. ... to automatically tell which desciptors you want to share between the parent and child and ... Sockets in gfortran? - comp.lang.fortran*/ /* See Stevens, Chapter 13. */ if (fork()>0) exit(0); /* Parent returns; child continues ... Communication between server/client (sockets)! - comp.unix ... Sockets in ... What is the differences between process group and process session ...However, if a process simply forks a child and the child forks the grandson, etc, all ... process group leader or joins some other process group, it is part of its parent ... fork() // parent & child communication - LinuxQuestions.orgfork() // parent & child communication ... the short answer is: yes you can communicate between the parent and child ... Unix & Linux: fork communication between parent & child ...programming.itags.org: Unix & Linux question: fork communication between parent & child, created at:Wed, 30 Apr 2008 14:24:00 GMT with 572 bytes, last updated ... 7/15/2012 1:58:22 PM
|
|
|
|
|
|
|
|
|