> Hi, all
> I have one process which forks many child processes.
> how many child processes can parent process fork?
In theory, all of them. <g> (Think of init (pid 1) and how every other
process is somehow a decendant of init).
In practice, it's limited by various means, including quotas/ulimits, OS
implementation (max processes in process table), and OS design
(hardcoded fork() throttling logic). There will also be exceptions and
escapehatches to these limits.
Quote:> if there is a maximun which is less than what i expect, i'd better have
> several same parent processes.
Which, of course, are children of another process <g>
Quote:> is that right?
It may be so.
Quote:> and, one more question.
> which one is more effective?
> 1. only one process doing a job.
> 2, several processes doing a job concurrently.
It depends on the job to be done. If the job is atomic (can't be
subdivided) then a single process will likely be more effective than
multiple processes because you'll avoid artifically imposed deadlocks
and race conditions. If the job can be subdivided effectively, then
several processes _may_ be more effective (assuming that there are
little or no external costs, like reduced processing intervals because
of the increased number of processes)
Master Codewright and JOAT-in-training
Registered Linux User #112576