[Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

Antoine Pitrou solipsis at pitrou.net
Mon Jul 16 13:07:35 EDT 2018


On Mon, 16 Jul 2018 18:00:37 +0100
MRAB <python at mrabarnett.plus.com> wrote:
> Could you explicitly share an object in a similar way to how you 
> explicitly open a file?
> 
> The shared object's refcount would be incremented and the sharing 
> function would return a proxy to the shared object.
> 
> Refcounting in the thread/process would be done on the proxy.
> 
> When the proxy is closed or garbage-collected, the shared object's 
> refcount would be decremented.
> 
> The shared object could be garbage-collected when its refcount drops to 
> zero.

Yes, I'm assuming that would be how shareable buffers could be
implemented: a per-interpreter proxy (with a regular Python refcount)
mediating access to a shared object (which could have an atomic /
thread-safe refcount).

As for how shareable buffers could be useful, see my work on PEP 574:
https://www.python.org/dev/peps/pep-0574/

Regards

Antoine.




More information about the Python-ideas mailing list