What are all the differences between pipes and message queues?

What are all the differences between pipes and message queues?

Please explain with both vxworks and unix perspectives.

I think the channels are unidirectional, but the message queues are not.

But shouldn't message queues be used internally, and then how pipes are unidirectional and message queues are not?

What are the other differences you can think of (from design or use or from other perspectives)?

+7
unix pipe message-queue ipc vxworks
source share
5 answers

Message Queues:

  • ONE DIRECTIONAL
  • Fixed number of entries
  • Each entry has a maximum size.
  • All queue memory (# records * record size) allocated at creation
  • Datagram behavior: reading a record removes it from the queue. If you have not read all the data, the rest will be lost. For example: send a 20-byte message, but the receiver reads 10 bytes. The remaining 10 bytes will be lost.
  • A task can depend on only one queue using msqQReceive (there are ways to change this using an alternative API)
  • When sending, you will delay if the queue is full (and you do not do NO_WAIT)
  • Upon receipt, you will delay if the queue is empty (and you do not execute NO_WAIT)
  • Latency is supported when receiving and sending

Pipes

  • Are messages with an add-on Queue <--- Unidirectional!
  • The maximum number of elements and the maximum size of each element
  • DOES NOT LOSE THE INTERFACE. Datagram semantics, only the list of messages Queues
  • In read mode WILL PEND until data is read.
  • When writing WILL PEND, there will be no space in the main message queue
  • You can use the select function to wait for multiple channels.

What I can think now.

+11
source share

"VxWorks pipes are significantly different from UNIX pipes," the vxWorks documentation says, and they arenโ€™t joking. Here are the manpages .

It does not seem to be an exaggeration to say that the only similarities between Unix and vxWorks pipes are that they are a form of IPC. The functions are different, the APIs are different, and the implementations are certainly very different.

+1
source share

I also found this difference in IPC on UNIX . It says that the difference between the two is that the message queues and channels are that the first stores / retrieves information in packets. While the pipes make it symbol by symbol.

Msg Queue:

Message Queue: An anonymous data stream that resembles a channel, but stores and receives information in packets.

pipes

Pipe: two-way data stream connected via standard input and output and read symbol by symbol

I also found this question here: Pipe vs msg queue

0
source share

Comparison of message queues and channels: - A single message queue can be used to transfer data in both directions - the message does not have to be read on a first basis, but can be processed selectively instead of the source: see http://www.cs.vsb.cz/grygarek/ dosys / IPC.txt

0
source share

MQs have kernel resilience and can be opened by several processes.

-one
source share

All Articles