From owner-freebsd-hackers Fri Nov 21 14:38:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA20482 for hackers-outgoing; Fri, 21 Nov 1997 14:38:14 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA20464 for ; Fri, 21 Nov 1997 14:38:03 -0800 (PST) (envelope-from toor@dyson.iquest.net) Received: (from root@localhost) by dyson.iquest.net (8.8.7/8.8.8) id RAA01688; Fri, 21 Nov 1997 17:37:47 -0500 (EST) (envelope-from toor) From: "John S. Dyson" Message-Id: <199711212237.RAA01688@dyson.iquest.net> Subject: Re: malloc() problems in children after using rfork() In-Reply-To: from Curtis Bray at "Nov 21, 97 01:44:53 pm" To: cbray@best.com (Curtis Bray) Date: Fri, 21 Nov 1997 17:37:47 -0500 (EST) Cc: nash@Mcs.Net, cbray@best.com, freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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