From owner-freebsd-questions Tue Jan 4 18:15:57 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bomber.avantgo.com (ws1.avantgo.com [207.214.200.194]) by hub.freebsd.org (Postfix) with ESMTP id 774E514D23 for ; Tue, 4 Jan 2000 18:15:55 -0800 (PST) (envelope-from scott@avantgo.com) Received: from river ([10.0.128.30]) by bomber.avantgo.com (Netscape Messaging Server 3.5) with SMTP id 224 for ; Tue, 4 Jan 2000 18:11:47 -0800 Message-ID: <002501bf5722$afa4c920$1e80000a@avantgo.com> From: "Scott Hess" To: Subject: How to use rfork(RFMEM) correctly. Date: Tue, 4 Jan 2000 18:15:07 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Concise: Does anyone have a simple, self-contained example of using rfork(RFMEM) to fork off a process that can share the parent process' memory and file descriptors? "Simple" == doesn't take days to understand, "self-contained" == doesn't require traipsing through thousands of lines of linuxthreads code to figure out what the relevant part is. Ideal would be a Linux clone() emulation without any of the associated threading libraries. I have a problem with blocking disk I/O and the pthreads library (basically, access is serialized which kills performance on large datasets). I've been able to model the problem in a simple program, and verified that if I use multiple processes instead of multiple threads, things get much better. Unfortunately, it isn't feasable to modify the full program (mysql) to use multiple seperate processes (well, it is feasable, it's just ugly). I have determined some fairly reasonable ways to fix the problem if I had something on the order of kernel threads. Which lead me to rfork(RFMEM). Unfortunately, rfork(RFMEM) seems to be horribly hard to use unless you are a kernel-level hacker (I've spent a couple hours going through the archives, and found tons of one-off comments saying "Just use rfork(RFMEM)", but nothing in the way of simple working code demonstrating how to do so). My next step will be to start whittling away at linuxthreads, until I have a bare clone() clone. I'm hoping someone has better pointers... Thanks, scott To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message