fork()

Arne Mueller a.mueller at icrf.icnet.uk
Mon Jun 7 12:45:21 EDT 1999


Hrvoje Niksic wrote:
> 
> Arne Mueller <a.mueller at icrf.icnet.uk> writes:
> 
> > All that woks fine now (after I spend a long time fiddling with the
> > pipe and select stuff to synchronize I/O). However the forking is a
> > waste of time and memory because all the children get their own
> > large dictionary!
> 
> If you don't change the dictionary, the memory will not be copied.
> Most modern Unixes support COW (copy on write) which means that the
> actual fork()ing does surprisingly little.  Only when the memory is
> written to, a new copy is spawned off.
> 
> If the children are modifying the dictionary, that's well something
> different...

Huh, that's realy good news! But I don't understand how that works, when
the child changes the dictionary it quickly gets it's own copy, so the
operating system is watching the child's activity and copies memory when
it's accessed for writing? However my children don't change anything in
the dictionary ;-)


	Thanks,
	Arne




More information about the Python-list mailing list