When using a fork() function in a program which is running in a Unix like operating system (i.e MINIX 3) does it create a number of separate processes which are handled independently and can therefore finish ahead of each other (which is actually what I want) or will it create a series of sequential processes which only finish in the order they were created.
Here is the code I'm using to fork()
for(j = 0; j < num_fork_loops;) {
if (fork() < 0) {
printf("Fork has failed\n");
exit(EXIT_FAILURE);
}
j++;
}
Thanks for your time
fork()
returns immediately, twice. All processes are normal, running processes, which are scheduled separately by the OS. Typically they will all run simultaneously.