On Thu, 7 Mar 2013 14:18:12 +0100 Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> I'm not talking about the semantics but about the implementation. > Simply said, vfork() was developed to avoid process memory copying > used at fork(). on linux, fork() does NOT copy process memory. vfork() also suspends execution of the parent until the child calls execve or _exit. If the child happens to write into its memory, the parent sees the changes... very different from fork(). Now, as for the great benefits of copy-on-write: It is actually almost useless with Perl programs. Here's the reason: Perl uses reference-counting to know when to free memory. So even if you access memory "read-only" by creating a new reference to the underlying object, that effectively becomes a write operation and Linux needs to copy the page. I think if you measure what happens to Perl processes that fork a number of children to handle requests, you'll see that there's very little memory sharing after a short while. Regards, David.