Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12171

fork in nested loops

$
0
0

can someone explain How many child processes do this program create?the answer is 127, but I couldn't understand how they got it.

int create(int num){int i;for(i=0;i<num;i++)fork();}int main() {int i;fork();for(i=0;i<4;i++)create(i);return 0; }

Viewing all articles
Browse latest Browse all 12171

Trending Articles