Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all the differences between pipes and message queues?

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)?

like image 531
aks Avatar asked Mar 18 '10 14:03

aks


People also ask

What is difference between pipes and named pipes?

A traditional pipe is “unnamed” and lasts only as long as the process. A named pipe, however, can last as long as the system is up, beyond the life of the process. It can be deleted if no longer used. Usually a named pipe appears as a file and generally processes attach to it for inter-process communication.

What is the difference between pipe and FIFO?

The pipe has no name; it is created for one use and both ends must be inherited from the single process which created the pipe. A FIFO special file is similar to a pipe, but instead of being an anonymous, temporary connection, a FIFO has a name or names like any other file.

What are the different types of message queue?

The system has different types of message queues: workstation message queue, user profile message queue, job message queue, system operator message queue, and history log message queue.

What is pipe and queue in embedded system?

The main difference between queues and pipes is the message size. Queues carry messages comprising a single ADDR – these would commonly be pointers. A pipe carries messages which are an arbitrary number of bytes long; the size is fixed for each pipe in the application and set at configuration time. Configuring Queues.


1 Answers

Message Queues are:

  • UNIDIRECTIONAL
  • Fixed number of entries
  • Each entry has a maximum size
  • All the queue memory (# entries * entry size) allocated at creation
  • Datagram-like behavior: reading an entry removes it from the queue. If you don't read the entire data, the rest is lost. For example: send a 20 byte message, but the receiver reads 10 bytes. The remaining 10 bytes are lost.
  • Task can only pend on a single queue using msqQReceive (there are ways to change that with alternative API)
  • When sending, you will pend if the queue is full (and you don't do NO_WAIT)
  • When receiving, you will pend if the queue is empty (and you don't do NO_WAIT)
  • Timeouts are supported on receive and send

Pipes

  • Are a layer over message Queues <--- Unidirectional!
  • Have a maximum number of elements and each element has maximum size
  • is NOT A STREAMING INTERFACE. Datagram semantics, just list message Queues
  • On read, WILL PEND until there is data to read
  • On write, WILL PEND until there is space in the underlying message queue
  • Can use select facility to wait on multiple pipes

That's what I can think of right now.

like image 188
Benoit Avatar answered Oct 03 '22 11:10

Benoit