1 | initial version |
The default parallel strategy is using "fork", so the global dictionary D isn't actually shared between the different processes. You only get to communicate in one way: the result you pass back. If you want to do more, you'll have to look into shared memory, and all the locking issues that come with it (which can create lock contention that can seriously hamper the gains to be had by parallel execution).
It might seem that using threading instead of processes would solve this problem in a nicer way, but you'd probably find that Python's GIL gives similar (or worse!) lock contention.