osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

array.array()'s memory shared with multiprocessing.Process()


Op 2017-09-12, Thomas Jollans schreef <tjol at tjol.eu>:
> I'm not sure actually. Maybe someone else here can help. I have a hunch
> that on Windows the memory might not be shared in the same way that it
> would on Linux/Unix, since Windows simply doesn't have the same process
> forking capabilities as Unix. 

`multiprocessing` is not relying on the POSIX "inherit an anonymous
mmap()" semantics to get a piece of memory shared across processes.

1. On Windows, it uses the Windows-specific functionality to
   associate a tagname with an mmap and open the specific mmap by tagname.

2. On Posix platforms, it creates a file which is opened and immediately
   unlink()-ed, and the file descriptor is communicated to the child
   process using a UNIX-domain socket.

Stephan