Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2000 18:15:07 -0800
From:      "Scott Hess" <scott@avantgo.com>
To:        <freebsd-questions@freebsd.org>
Subject:   How to use rfork(RFMEM) correctly.
Message-ID:  <002501bf5722$afa4c920$1e80000a@avantgo.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002501bf5722$afa4c920$1e80000a>