[Python-ideas] An error in multiprocessing on MacOSX?

Ronald Oussoren ronaldoussoren at mac.com
Wed Nov 21 21:44:24 CET 2012


On 21 Nov, 2012, at 20:25, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Wed, 21 Nov 2012 16:12:04 +0100
> Sturla Molden <sturla at molden.no> wrote:
> 
>> See this:
>> 
>> http://mail.scipy.org/pipermail/numpy-discussion/2012-August/063593.html
>> 
>> According to Apple enineers:
>> 
>> """
>> For API outside of POSIX, including GCD and technologies like
>> Accelerate, we do not support usage on both sides of a fork(). For
>> this reason among others, use of fork() without exec is discouraged in
>> general in processes that use layers above POSIX.
>> """
>> 
>> Multiprocessing on OSX calls os.fork, but not os.exec.
>> 
>> Thus, is multiprocessing errorneously implemented on Mac? Forking 
>> without calling exec means that only APIs inside POSIX can be used by 
>> the child process.
> 
> Or perhaps "fork()" is erroneously implemented on Mac.

Fork works fine, its "just" that most system libraries above the POSIX layer don't bother to clean
up their state in the child proces. 

There may be good reasons for that (cleaning up state changes by background threads
might be hard), but its pretty annoying non the less.

Ronald



More information about the Python-ideas mailing list