管道和消息队列之间有哪些区别?
管道和消息队列之间有什么区别?
请从vxworks & 解释两者。 UNIX 视角。
我认为管道是单向的,但消息队列不是。
但是管道内部不使用消息队列,那么为什么管道是单向的而消息队列不是?
您能想到的其他差异是什么(从设计或使用或其他角度)?
What are all the differences between pipes and message queues?
Please explain both from vxworks & unix perspectives.
I think pipes are unidirectional but message queues aren't.
But don't pipes internally use message queues, then how come pipes are unidirectional but message queues are not?
What are the other differences you can think of (from design or usage or other perspectives)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
消息队列有:
接收和发送管道
这就是我现在能想到的。
Message Queues are:
Pipes
That's what I can think of right now.
我还在 UNIX 中的 IPC 中发现了这种差异。它指出它们之间的区别在于消息队列和管道首先在数据包中存储/检索信息。而管道则一个字符一个字符地执行。
消息队列:
管道
我也在这里发现了这个问题:管道 vs 消息队列
I also found this difference in IPC in UNIX. It states that the difference between them is that Message queues and pipes is that the first stores/retrieves info in packets. While pipes do it character by character.
Msg queue:
Pipe
I also found this question here: Pipe vs msg queue
vxWorks 文档说:“VxWorks 管道与 UNIX 管道有很大不同”,他们不是在开玩笑。 这是手册页。
看起来,可以毫不夸张地说,Unix 管道和 vxWorks 管道之间唯一的相似之处在于它们都是 IPC 的一种形式。功能不同,API 不同,实现也肯定有很大不同。
"VxWorks pipes differ significantly from UNIX pipes", says the vxWorks documentation, and they ain't kidding. Here's the manpages.
It looks like it would not be exaggerating much to say that the only similarity between Unix pipes and vxWorks pipes are that they're a form of IPC. The features are different, the APIs are different, and the implementations are surely very different.
消息队列和管道的对比:
- 一个消息队列可用于双向传递数据
- 消息不需要以先进先出的方式读取
但可以选择性地处理
来源:参见 http://www.cs.vsb.cz/grygarek/dosys/ IPC.txt
Comparison of message queues and pipes:
- ONE message queue may be used to pass data in both directions
- the message needn't to be read on first in-first out basis
but can be processed selectively instead
source: see http://www.cs.vsb.cz/grygarek/dosys/IPC.txt
MQ 具有内核持久性,并且可以由多个进程打开。
MQs have kernel persistence, and can be opened by multiple processes.