在进程之间进行通信时,队列比管道有什么优势? [英] What's the advantage of queues over pipes when communicating between processes?

查看:14
本文介绍了在进程之间进行通信时,队列比管道有什么优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 2 管道上的">队列a> 在进程之间进行通信?

What would be the advantage(s) (if any) of using 2 Queues over a Pipe to communicate between processes?

我打算使用 multiprocessing python 模块.

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.

这篇关于在进程之间进行通信时,队列比管道有什么优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆