Results 1 to 4 of 4
Hello!
I'm writing a program which should use fork() and exec() to create many child processes, possibly more than 1000. I've run the program once and no processes were created ...
- 12-21-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 21
Creating more than 1000 processes from a single parent process
Hello!
I'm writing a program which should use fork() and exec() to create many child processes, possibly more than 1000. I've run the program once and no processes were created after the first 300 or 400 processes had been created. I didn't check the error in fork() and exec(), so I don't know what happeded. Is it that the maximum number of processes that one user can create has been exceeded? If so, I'm considering recycling pid. Is this feasible? And how to do this? Or if what I think is wrong, how can I create more than 1000 processes from a single parent process?
- 12-21-2008 #2That's a bug.I didn't check the error in fork() and exec()
That limit is a feature, to prevent fork bombs, whether intended or not.the maximum number of processes that one user can create has been exceeded
Do this at the command line:I'm considering recycling pid. Is this feasible? And how to do this?
Code:man waitpid
If you want them all to be running at the same time, you can't. If you don't, waitpid() will do the trick for you.how can I create more than 1000 processes from a single parent process?--
Bill
Old age and treachery will overcome youth and skill.
- 12-21-2008 #3Just Joined!
- Join Date
- Feb 2008
- Posts
- 21
Oh, I forgot to mention that they don't run at the same time. There's a master process to assure that these 1000 processes are run in good order and 8 processes are run at the same time. So I would like to recycle the pids that have already finished. I read man page for waitpid(), but it simply says how to wait a process to finish and get the exit state. I still can't figure out how to recycle a pid, so can you give a more detailed explanation?
- 12-21-2008 #4waitpid() recycles the pid. The only reason a zombie process hangs around is so you can use wait() or waitpid() to get the exit status.So I would like to recycle the pids that have already finished. I read man page for waitpid(), but it simply says how to wait a process to finish and get the exit state.
Details may be found in the wikipedia article about zombie processes.--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote