[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-08-02 Thread Vinay Sharma via Python-ideas
sharedctypes can only be used with related processes. There is no way that you can pass a sharedctype to an unrelated process. multiprocessing.shared_memory was created to handle this i.e. allow usage of shared memory IPC across unrelated processes. > On 02-Aug-2020, at 9:42 PM, Marco Sulla

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-08-02 Thread Vinay Sharma via Python-ideas
I understand that I won’t need locks with immutable objects at some level, but I don’t understand how they can be used to synchronise shared memory segments. For every change in an immutable object, a copy is created which will have a different address. Now, for processes to use this updated

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-08-01 Thread Vinay Sharma via Python-ideas
> On 01-Aug-2020, at 1:31 AM, Marco Sulla wrote: > > On Thu, 30 Jul 2020 at 12:57, Vinay Sharma via Python-ideas > mailto:python-ideas@python.org>> wrote: > Python has support for atomic types, I guess: > Atomic Int: > https://github.com/python/cpython/b

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-07-31 Thread Vinay Sharma via Python-ideas
020, at 10:10 PM, Barry Scott wrote: > > > >> On 30 Jul 2020, at 11:55, Vinay Sharma via Python-ideas >> mailto:python-ideas@python.org>> wrote: >> >> >> >>> On 28-Jul-2020, at 5:19 AM, Robert Collins >> <mailto:robe...@rober

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-07-30 Thread Vinay Sharma via Python-ideas
a lot of prior art on named locks of various sorts, I'd > personally be inclined to give the things a name that can be used > across different processes in some form and bootstrap from there. > >> Any thoughts on that ? >> >>> On 27-Jul-2020, at 3:50 PM, R

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-07-27 Thread Vinay Sharma via Python-ideas
ect will also be shared across multiple processes, there must be a safe way to update it. Any thoughts on that ? > On 27-Jul-2020, at 3:50 PM, Robert Collins wrote: > > On Sun, 26 Jul 2020 at 19:11, Vinay Sharma via Python-ideas > wrote: >> >> Problem: >>

[Python-ideas] How to prevent shared memory from being corrupted ?

2020-07-26 Thread Vinay Sharma via Python-ideas
Problem: Currently, let’s say I create a shared_memory segment using mulitprocessing.shared_memory.SharedMemory in Process 1 and open the same in Process 2. Then, I try to write some data to the shared memory segment

[Python-ideas] Re: Shared Semaphores for synchronisation across unrelated processes

2020-06-09 Thread Vinay Sharma via Python-ideas
> Is it worth broadening out the discussion to other sorts of named objects? > Named Pipes particularly spring to my mind... The main reason why I requested this enhancement was to ensure that multiple processes can read/write a shared memory segment without corrupting that data in it. To

[Python-ideas] Re: Shared Semaphores for synchronisation across unrelated processes

2020-06-09 Thread Vinay Sharma via Python-ideas
AM, Vinay Sharma via Python-ideas > wrote: > > Hi, > As Barry wrote, I am asking for the ability to use shared semaphores in > python across unrelated processes. So, that shared memory used across > unrelated processes can be synchronised. > > Although, I am suggesting th

[Python-ideas] Re: Shared Semaphores for synchronisation across unrelated processes

2020-06-05 Thread Vinay Sharma via Python-ideas
Hi, As Barry wrote, I am asking for the ability to use shared semaphores in python across unrelated processes. So, that shared memory used across unrelated processes can be synchronised. Although, I am suggesting this only because I am unable to synchronise shared memory across unrelated

[Python-ideas] Shared Semaphores for synchronisation across unrelated processes

2020-06-05 Thread Vinay Sharma via Python-ideas
Hi, Python has integrated shared memory into standard library starting from 3.8 (https://docs.python.org/3/library/multiprocessing.shared_memory.html ), which provides a user friendly API to access shared memory across

[Python-ideas] Re: Support for atomic types in Python

2019-09-13 Thread Vinay Sharma via Python-ideas
If you see my first mail, I have mentioned that gcc has support for atomic builtins, which can be used to support atomic behaviour. You can refer gcc’s documentation for the same at https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins

[Python-ideas] Re: Support for atomic types in Python

2019-09-13 Thread Vinay Sharma via Python-ideas
3/09/2019 14:32, Vinay Sharma via Python-ideas wrote: >> As you said there can be lot of possible use cases for the proposed >> feature, since there are lot’s of use cases for a lock. I can tell >> you some cases which I am facing. > > I don't in principle object to having

[Python-ideas] Re: Support for atomic types in Python

2019-09-13 Thread Vinay Sharma via Python-ideas
of multiprocessing. > On 10-Sep-2019, at 2:27 PM, Antoine Pitrou wrote: > > > Hi Vinay, > > On Mon, 09 Sep 2019 08:23:48 -0000 > Vinay Sharma via Python-ideas > wrote: >> >> Also, as far as I know (might be wrong) Value is stored in shared memory and >

[Python-ideas] Re: Support for atomic types in Python

2019-09-09 Thread Vinay Sharma via Python-ideas
ce question on "how to rename a dict key" - and even them, it felt a bit overkill. In other words, I may be wrong, but I think you are talking about a non-issue here. On Sun, 8 Sep 2019 at 11:33, Vinay Sharma via Python-ideas wrote: Currently, C++ has support for atomic types, on

[Python-ideas] Support for atomic types in Python

2019-09-08 Thread Vinay Sharma via Python-ideas
Currently, C++ has support for atomic types, on which operations like add, sub, xor, etc can be done atomically, thereby avoiding data races. Having such a support will be very helpful in Python. For instance users won't have to use Locks for synchronising shared variables in case of