Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When to lock data items returned by multiprocessing.Manager?

2 views
Skip to first unread message

Veloz

unread,
Mar 3, 2010, 11:39:18 AM3/3/10
to
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

Aahz

unread,
Mar 15, 2010, 3:57:23 PM3/15/10
to
In article <4428d674-7fa7-4095...@15g2000yqi.googlegroups.com>,

Veloz <michae...@gmail.com> wrote:
>
>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 (aa...@pythoncraft.com) <*> 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

0 new messages