What's the advantage of queues over pipes when communicating between processes?
What would be the a开发者_如何学编程dvantage(s) (if any) of using 2 Queues over a Pipe to communicate between processes?
I am planning on using the multiprocessing
python module.
The big win is that queues are process- and thread- safe. Pipes are not: if two different processes try to read from or write to the same end of a pipe, bad things happen. Queues are also at a somewhat higher level of abstraction than pipes, which may or may not be an advantage in your specific case.
Queues hold the messages and retains them until the next time the queue is active and pushes it through...regardless if the pipe or connection is broken...with a pipe/connection, its goodbye to the message with an error...
Hope this helps, Best regards, Tom.
精彩评论