A managers.dict() allow to share a dictionary across process and perform thread-safe operation.
In my case each a coordinator process create the shared dict with m
elements and n
worker processes read and write to/from a single dict key.
Do managers.dict()
have one single lock for the dict or m
locks, one for every key in it?
Is there an alternative way to share m
elements to n
workers, other than a shared dict, when the workers do not have to communicate with each other?
Related python-manager-dict-is-very-slow-compared-to-regular-dict
After some tries I can say there is only one lock per managers dict. Here is the code that proves it:
output:
The increasing time for writing show the waiting which is happening.