Hi Vinay,

On Mon, 09 Sep 2019 08:23:48 -0000
Vinay Sharma via Python-ideas
<python-ideas@python.org> wrote:
> 
> Also, as far as I know (might be wrong) Value is stored in shared memory and 
> is therefore very fast also. So, what I am proposing is a similar object to 
> value to which operations like add, sub, xor, etc are atomic. Therefore, I 
> wouldn't have to use lock at all for synchronization. Updates to these values 
> can be made very easily by using calls such as __sync_and_and_fetch(), even 
> when they are stored in a shared memory segment, accessible across processes.

I'm curious what your use case is.  I have never seen
multiprocess Python programs operate at this low level of concurrency
(though it's generally possible).  The common model when using
multiprocessing is to dispatch large tasks and let each worker grind on
a task on its own.  If you spend your time synchronizining access to
shared memory (to the point that you need a separate lock per
shared variable), perhaps your model of sharing work between processes
is not right.

In any case, providing C++-like atomic types sounds very low-level in a
language like Python.  I'm skeptical that it would address more than a
couple extremely niche use cases, though I'd be happy to be proven
wrong.

Regards

Antoine.

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JMVCCKMGLAJRUP5P2O2UZADLWNCRUDEE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to