On 10/19/06, Steve <[EMAIL PROTECTED]> wrote:
So what's the total number assuming infinite "allowed" processes, that
this stinker managed to spawn?
2^10
I don't think the post-increment matters. The first child will still
only spawn nine others. Example with i = 3:
#include <stdio.h>
int main (int argc, char *argv[])
{
int x;
for(x=0; x<3; x++){ fork(); }
printf("I am Spartacus!\n");
}
output:
I am Spartacus!
I am Spartacus!
I am Spartacus!
I am Spartacus!
I am Spartacus!
I am Spartacus!
I am Spartacus!
I am Spartacus!
In every iteration, each process forks. So the number of processes
doubles each iteration. 3 iterations, 2^3=8 processes.
Jacob Fugal
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/