copy-on-write (oh well)

Chris Faylor cgf@cygnus.com
Wed Jul 5 19:26:00 GMT 2000


On Mon, Jul 03, 2000 at 10:53:57PM -0400, cgf wrote:
>I spent part of my "day off" today hacking together a "copy-on-write"
>implementation for copying the heap after a fork.  I've long wanted to
>try to do something like this.  It seems to work pretty well as long as
>I don't fork something that forks something else.
>
>I can't tell if there is a performance improvement or degradation or not
>yet.
>
>I hope that nobody is standing while reading this because I have some
>shocking news.
>
>The copy-on-write functionality is badly broken on Windows 95, so I
>can't use it there.  This only works on NT.

I couldn't figure out how to get copy-on-write working beyond the
first level of fork.  There doesn't seem to be any way to share
a pool of memory inherited from a parent process and potentially
updated with a copy-on-write operation.

It turns out not to matter anyway.  The current version of fork is
somehow, inexplicably faster than my copy-on-write version.

I also tried having the child process inherit the parent's memory
and just memcpy'ing the parent's memory into the child's malloc
pool.  That was the slowest of all.

Oh well.

cgf


More information about the Cygwin-developers mailing list