When to lock data items returned by multiprocessing.Manager?

V

Veloz

So I'm using a multiprocessing.Manager instance in my main app and
asking it to create a dictionary, which I am providing to instances of
the application that I'm forking off with Process.

The Processes and main app will be reading/writing to the dictionary.

It's not clear to me what I have to "lock" and what I don't have to
lock. Any ideas?

I'm thinking that what Manager brings to the table is the ability to
share the dictionary but it may not provide anything to control
concurrent access to it, and thus I should lock all operations I
perform on it.. But I don't know this for a fact. Any input is
welcomed on this!!

Michael
 
A

Aahz

So I'm using a multiprocessing.Manager instance in my main app and
asking it to create a dictionary, which I am providing to instances of
the application that I'm forking off with Process.

The Processes and main app will be reading/writing to the dictionary.

It's not clear to me what I have to "lock" and what I don't have to
lock. Any ideas?

The way I deal with it is by making sure each key is only updated by a
single process.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top