Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 1996 09:07:32 -0700 (MST)
From:      Softweyr LLC <softweyr@xmission.com>
To:        kline@tera.com (Gary Kline)
Cc:        questions@freebsd.org
Subject:   Re: multi-media app runs out of forking capabilities
Message-ID:  <199612271607.JAA19151@xmission.xmission.com>
In-Reply-To: <199612270100.RAA10931@athena.tera.com> from "Gary Kline" at Dec 26, 96 05:00:28 pm

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 Dec 1996, Gary Kline wrote:

>   I didn't think that this would stall my devlopment, but
>   it has.  Before I upgraded to 32MB of memory I sometimes
>   would get a ``Can't fork'' error from the kernel.  I 
>   thought that having 32 megs would automagically resolve
>   this problems, but no such luck.
> 
>   Now I'm writing a multi-media app that does many forks
>   to spawn and kill ancillary processes, and I am getting
>   the same `can'tt fork' messages.

And later asked:
> 		Will do, thanks..  I've also thought of another
> 		way that would obviate all these scores of forks::
> 		Using whatever IPC that FBSD has might work.
> 
> 		Is there a way that one program can send a flag
> 		to another program?  Assuming yes, where is some
> 		sample code??

Sure.  Signals are a simple, but error prone way.  A UNIX-domain socket
or a FIFO would work well, or even a MSGQ.  You can find instructions
on using most (or maybe all) of these in W. Richard Stevens' excellent
books _UNIX Network Programming_ (0-13-949876-1) and _Advanced
Programming in the UNIX Environment_ (0-201-56317-7), both from
Prentice Hall.

Your 'can't fork' messages may be caused by the per-process limits on
child processes.  Are you gathering the status of your child processes
with wait(2) at any point?  If not, all of your child processes will
remain counted against your per-process limit until you wait() for them.
Richards UNIX book will explain the UNIX process model and the relation-
ship between parent and child processes better than I can here.  ;^)

-- 
          "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                       Softweyr LLC
http://www.xmission.com/~softweyr                       softweyr@xmission.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612271607.JAA19151>