![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with child comunicating with parent on fork() | Zarnick | High Level Programming | 8 | 05-06-2008 09:35 AM |
| fork() and child processes | green_dot | Shell Programming and Scripting | 1 | 03-19-2008 05:49 AM |
| fork() with su (child with other user) | heck | High Level Programming | 1 | 01-12-2007 06:58 AM |
| Parent/Child Processes | yoi2hot4ya | Shell Programming and Scripting | 2 | 05-31-2006 10:27 AM |
| Reference Variables To A Child Process Created With Fork | AJAY BHATIA | High Level Programming | 2 | 10-07-2001 05:41 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
fork() and child processes
Hello,
How many child processes are actually created when running this code ? Code:
#include <signal.h>
#include <stdio.h>
int main () {
int i ;
setpgrp () ;
for (i = 0; i < 10; i++) {
if (fork () == 0) {
if ( i & 1 ) setpgrp () ;
printf ("Child id: %2d, group: %2d\n", getpid(), getpgrp()) ;
sleep (60) ;
exit (0) ;
}
}
kill (0, SIGINT) ;
return 0 ;
}
Last edited by Yogesh Sawant; 03-19-2008 at 05:50 AM. Reason: added code tags |
|||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|