0

I know there is a Value type could allocate shared memory, but seems it could only contains basic c types.

Is there anyway allow us to pass complex data types like Queue/Map between processes ?

1 Answer 1

1

Use Managers. Create a Manager object, then invoke manager.Queue (for example) to create a sharable Queue proxy. You can then pickle the returned proxy object and pass that between processes.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, @nneonneo, How about the Queue's performance if I read and write via multi processes ? Is it using Lock or CAS to make the shared Queue safe ?
The shared Queue is implemented using Queue.Queue, which internally uses locks to achieve thread safety. Process safety is ensured by the Manager, which controls access. You should benchmark the Queue against other approaches and to see how its performance fares on your specific platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.