在进程之间进行通信时,通过管道排队的优点是什么? [英] What's the advantage of queues over pipes when communicating between processes?

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

问题描述

使用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天全站免登陆