On Monday, 15 June 2015 at 22:25:27 UTC, Tofu Ninja wrote:
I think fork just does copy on write, so all the garbage that
is no longer being referenced off in random pages shouldn't get
copied. Only the pages that get written are actually copied.
You are correct. fork() guarantees separate address spaces for
the parent and the child processes, but there's a note in it's
man page:
NOTES
Under Linux, fork() is implemented using copy-on-write
pages,
so the only penalty that it incurs is the time and memory
required to
duplicate the parent's page tables, and to create a unique
task
structure for the child.