Creating multiprocessing processes without forking on MacOSX?

Bob Petersen bob at vitamindinc.com
Mon Jun 29 22:21:07 EDT 2009


All,

I am using the multiprocessing backport with Python 2.5.4 on a
cross-platform Mac/Windows app.   Things were going swimmingly until I tried
to load a library on the Mac that calls CoreFoundation system calls.  I
discovered that certain (many?) OSX system calls fail when called from a
forked process.  See
http://developer.apple.com/technotes/tn2005/tn2083.html#SECDAEMONVSFRAMEWORKSand
http://developer.apple.com/releasenotes/CoreFoundation/CoreFoundation.html(search
for "fork").

Unfortunately, we are already using multprocessing (and its Queues and
Pipes) and have a lot of time invested in it.  The three options I see are
(1) replace multiprocessing with subrocess calls, (2) wrap the library that
makes the MacOSX calls in a separate "server" process, or (3) modify the
multiprocessing module to, on the Mac, be able to create "non-forked"
processes (using subprocess, or fork() then exec*(), or similar).

My question is, how realistic is #3?  On the Windows side multiprocessing is
not using fork(), so it seems like the library may already support this.  If
this is not completely crazy, I'd be interested in suggestions on what would
have to change.  I'm happy to provide a patch if it is useful to others.

Thanks,
Bob Petersen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090629/8a8ab060/attachment.html>


More information about the Python-list mailing list