![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts 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 | High Level Programming | 0 | 03-19-2008 04:44 AM |
| fork() with su (child with other user) | heck | High Level Programming | 1 | 01-12-2007 05: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 |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 04:47 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|