Children's exit() status

Scott Neugroschl abcscnge at csuna.UUCP
Sat May 21 01:44:25 AEST 1988


In article <4626 at mcdchg.UUCP> lenb at houxs.UUCP writes:
>                The question is, is it possible that my program
>  be woken up only 20 times, for 30 children.  Ie. could I miss
>  child deaths because several occur "simultaneously".  (simultaneously
>  

As I understand it, wait() returns the PID of one child.  Therefore,
you should not get signals from the two children.  Another possibility:
nice() the children, so that the parent has a higher priority than the
child tasks. i.e.:

	for (i = 0  ; i < NUM_PROCS ; i++)
	{
	    if ((pid = fork()) == -1) 
	    {
		    /* BAD FORK() */
	    }
	    else if (pid == 0)   /* child process */
	    {
		nice(5);		/* lower my priority */
	    }
	    else 
	    {
		/* do parent process stuff */
	    }
	}

Just some thoughts...
-- 
Scott "The Pseudo-Hacker" Neugroschl
UUCP: {litvax,humboldt,sdcrdcf,rdlvax,ttidca,}\_ csun!abcscnge
      {psivax,csustan,nsc-sca,trwspf         }/
-- "They also surf who stand on waves"



More information about the Comp.unix mailing list