How can you use C to spawn an independent child process that goes about its business without thinking about the father?
I want to spawn several processes and shortly after they have been created they go to sleep for about 2 minutes before they do their job.
However, I don't want the father to wait until the child is finished because in the meantime I want to spawn off more processes.
I'm on Linux.
Use fork(). The fork() System Call
pid_t pid = fork ();
if (pid < 0)
// Error
else if (pid == 0)
// Child Process
// Sleep 2 min. ?!
else
// Code for Father