[uClibc] vfork() wrapper in libpthread: BAD!

Erik Andersen andersen at codepoet.org
Tue May 4 09:04:19 UTC 2004


On Tue May 04, 2004 at 04:48:57PM +0800, Rogelio Serrano wrote:
> Are there other ways to implement fork? Like copy the process 
> image and then relocate?

Since there is no mmu, it is not possible to do a simple copy of
the entire process address space to some new location for the
child process, since that child would still be packed full of
pointers to stuff in the old address space.  And lacking an mmu
that child could very well proceed to muck about with the parents
memory.  So a preemptive copy per your question is not really
feasible.

I suppose it _might_ be possible to massively hack up the kernel
to do a full copy of the entire process address space to some
backing store area at each context switch, and then copy the lot
back again each time that pid begins running again.  That would
probably work and could provide the basis for building a working
mmu-less fork(), but IMHO doing that would be horribly evil and
performace would (at best) suck rocks.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list