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

Richard Oudkerk shibturn at gmail.com
Tue Nov 27 23:53:52 CET 2012


On 27/11/2012 9:37pm, Sturla Molden wrote:
> I would suggest to use a piece of shared memory and atomic compare-and-swap.
 > Shared memory can be pickled (e.g. take a look at what I have on github).

On unix (without assuming a recent gcc) there isn't any cross platform 
way of doing compare-and-swap or other atomic operations.  And even if 
there were, you need to worry about busy-waiting.

One could also consider using a process-shared semaphore or mutex 
allocated from shared memory, but that does not seem to be available on 
many platforms.

A simple (but wasteful) alternative would be to build a lock/semaphore 
from a pipe: write to release and read to acquire.  Then you can use 
normal fd passing.

-- 
Richard




More information about the Python-ideas mailing list