Copy-on-write when forking a python process

Heiko Wundram modelnine at modelnine.org
Fri Apr 8 13:26:43 EDT 2011


Am 08.04.2011 18:14, schrieb John Connor:
> Has anyone else looked into the COW problem?  Are there workarounds
> and/or other plans to fix it?  Does the solution I am proposing sound
> reasonable, or does it seem like overkill?  Does anyone foresee any
> problems with it?

Why'd you need a "fix" like this for something that isn't broken? COW
doesn't just refer to the object reference-count, but to the object
itself, too. _All_ memory of the parent (and, as such, all objects, too)
become unrelated to memory in the child once the fork is complete.

The initial object reference-count state of the child is guaranteed to
be sound for all objects (because the parent's final reference-count
state was, before the process image got cloned [remember, COW is just an
optimization for a complete clone, and it's up the operating-system to
make sure that you don't notice different semantics from a complete
copy]), and what you're proposing (opting in/out of reference counting)
breaks that.

-- 
--- Heiko.



More information about the Python-list mailing list