I am using the Pool class from the python multiprocessing library to do some processing of shared memory in an HPC cluster.
Processes are not threads! You cannot just replace Thread with Process and expect everyone to work the same way. Process es do not make shared memory, which means that global variables are copied, so their value in the original process does not change.
If you want to use shared memory between processes, you must use multiprocessing data types such as Value , Array , or use Manager to create shared lists, etc.
In particular, you might be interested in the Manager.register method, which allows Manager create common user objects (although they must be selected).
However, I'm not sure if this will improve performance. Since any connection between processes requires etching, and etching usually takes longer, it simply creates an instance of the object.
Note that you can do some initialization of workflows that pass initializer and initargs when creating the Pool .
For example, in its simplest form, create a global variable in a workflow:
def initializer(): global data data = createObject()
Used as:
pool = Pool(4, initializer, ())
Then the working functions can easily use the global variable data .
Style Note: Never use the built-in name for your variables / modules. In your case, object is inline. Otherwise, you will receive unexpected errors that may be unclear and difficult to track.