Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 1997 17:37:47 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        cbray@best.com (Curtis Bray)
Cc:        nash@Mcs.Net, cbray@best.com, freebsd-hackers@freebsd.org
Subject:   Re: malloc() problems in children after using rfork()
Message-ID:  <199711212237.RAA01688@dyson.iquest.net>
In-Reply-To: <Pine.BSF.3.96.971121133610.10841A-100000@shell5.ba.best.com> from Curtis Bray at "Nov 21, 97 01:44:53 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Curtis Bray said:
> 
> 
> On Fri, 21 Nov 1997, Alex Nash wrote:
> 
> > On Fri, 21 Nov 1997, Curtis Bray wrote:
> > 
> > > Hi,
> > > 
> > >   I'm trying to use rfork(RFPROC | RFMEM) so that all the children can
> > > share the same address space with their parent.  
> > > 
> > >   If I have multiple children issuing mallocs the children seem to core
> > > dump.  Once I turn the RFMEM flag off I have no problem mallocing (but
> > > of course I loose the shared address space).  Anyone know what I could
> > > be doing wrong here?  Do I have to put semaphores around every malloc?? 
> > > I hope that's not the case...  Thanks in advance!
> > 
> > The only locking malloc() performs is pthread_mutex_lock/unlock in the
> > libc_r version.  The non-threaded version provides no locking at all.
> > 
> 
>    I was hoping to avoid the pthread package because I need my threads (or
> children processes in this case) to perform a lot of file IO.  I appears
> that since non-blocking file IO doesn't exist in 4.4BSD that this approach
> would cause all my threads to block while one of them is waiting for data
> off the disk.  Obviously this defeats the purpose of a threaded app! 
> 
I should have the AIO stuff done soon...  It will work on ANY filedescriptor.

-- 
John
dyson@freebsd.org
jdyson@nc.com



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