Threads vs Processes

Paul Rubin http
Wed Jul 26 16:32:25 EDT 2006


"Carl J. Van Arsdall" <cvanarsdall at mvista.com> writes:
> Processes seem fairly expensive from my research so far.  Each fork
> copies the entire contents of memory into the new process.

No, you get two processes whose address spaces get the data.  It's
done with the virtual memory hardware.  The data isn't copied.  The
page tables of both processes are just set up to point to the same
physical pages.  Copying only happens if a process writes to one of
the pages.  The OS detects this using a hardware trap from the VM
system.



More information about the Python-list mailing list