[issue35813] shared memory construct to avoid need for serialization between processes

Davin Potts report at bugs.python.org
Thu Feb 21 00:25:04 EST 2019


Davin Potts <python at discontinuity.net> added the comment:

The simpler API is now implemented in GH-11816 as discussed previously.  Notably:
> * We go with this simpler API:  SharedMemory(name=None, create=False, size=0)
> * 'size' is ignored when create=False
> * create=True acts like O_CREX and create=False only attaches to existing shared memory blocks

As part of this change, the PosixSharedMemory and WindowsNamedSharedMemory classes are no more; they have been consolidated into the SharedMemory class with a single, simpler, consistent-across-platforms API.

On the SharedMemory class, 'size' is now stored by the __init__ and does not use fstat() as part of its property.

Also, SharedMemoryManager (and its close friends) has been relocated to the multiprocessing.managers submodule, matching the organization @Giampaolo outlined previously:
    multiprocessing.managers.SharedMemoryManager
    multiprocessing.managers._SharedMemoryTracker
    multiprocessing.managers.SharedMemoryServer  (not documented)
    multiprocessing.shared_memory.SharedMemory
    multiprocessing.shared_memory.SharedList 
    multiprocessing.shared_memory.WindowsNamedSharedMemory  (REMOVED)
    multiprocessing.shared_memory.PosixSharedMemory  (REMOVED)

I believe this addresses all of the significant discussion topics in a way that brings together all of the excellent points being made.  Apologies if I have missed something -- I did not think so but I will go back through all of the discussions tomorrow to double-check.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35813>
_______________________________________


More information about the Python-bugs-list mailing list