FreeBSD deadlock (with fork?)
David Naylor
naylor.b.david at gmail.com
Thu Sep 18 16:57:52 UTC 2008
On Thursday 18 September 2008 15:33:52 Tom Evans wrote:
> On Thu, 2008-09-18 at 06:31 +0200, David Naylor wrote:
> > Hi,
> >
> > I have a program that spawns a lot of subprocesses (with pipes open) from
> > multiple threads. The problem is the program often deadlocks, but not
> > consistently. Sometimes the program can run over 5 times to competition
> > without incidence and yet othertimes it locks within a few seconds.
>
> Do you create threads, which then fork(), or do you fork() and then create
> threads?
I have many threads that then fork. (aka forking threads).
>
> I think the former will not work..
Is there any reason for this and is this a FreeBSD limitation or a general
problem?
The problem is that my program has to have threads (or something similar)
since it handles lots of IO bound processes concurrently so is there a
work-a-round for this problem?
I could limit the forking to a single thread (which I tried and did not work)
but perhaps I need to have it fork from the master thread?
One option I considered was forking a 'slave' program that then does all the
forking but that will become exceedingly complex (with the communication
between the 'slave' and the threads).
Lastly, how does GUIs, such as Qt, handle forking since they are threaded and
some do fork?
>
> Cheers
>
> Tom
Regards
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20080918/f9629c4a/attachment.pgp
More information about the freebsd-current
mailing list