#include<stdio.h>
#include <stdlib.h>
#include<unistd.h>
#include<sys/wait.h>
int i;
pid_t pidchild;
int main()
{
printf("main process (%ld)\n",getpid());
for(i=0; i<2; i++)
{
if(fork()) // #1 call
fork(); // #2 call
}
}
العمليات المولدة ???
#include<stdio.h>
#include <stdlib.h>
#include<unistd.h>
#include<sys/wait.h>
int i;
pid_t pidchild;
int main()
{
printf("main process (%ld)\n",getpid());
for(i=0; i<2; i++)
{
if(fork()) // #1 call
fork(); // #2 call
}
}
العمليات المولدة ???
hamidelj كتب:#include<stdio.h>
#include <stdlib.h>
#include<unistd.h>
#include<sys/wait.h>
int i;
pid_t pidchild;
int main()
{
printf("main process (%ld)\n",getpid());
for(i=0; i<2; i++)
{
if(fork()) // #1 call
fork(); // #2 call
}
}
العمليات المولدة ???
i =0 <<< يتم مناداة "fork#1 and fork#2 " من طرف main process
i =1 <<< يتم مناداة "fork#1 and fork#2 "من طرف main process and 2 children
total of children =6 ???
C++ and Java, say, are presumably growing faster than plain C, but I bet C will still be around. ― Dennis Ritchie
~OoO~________--------------------------------------------________~OoO~
من مواضيعي :