Search code examples
posixipc

what should be used SystemV Message queue or POSIX message queue?


What I should use in my Embedded Linux environment, System V message queue or Posix message queue? What is popularly used in projects?


Solution

  • Both have the same basic tools -- semaphores, shared memory and message queues. They offer a slightly different interface to those tools, but the basic concepts are the same. One notable difference is that POSIX offers some notification features for message queues that Sys V does not. (See mq_notify().)

    Sys V IPC has been around for longer which has a couple of practical implications.

    POSIX message queues also have the following specific advantages over System V message queues:

    1. The message notification feature allows a (single) process to be asynchronously notified via a signal or the instantiation of a thread when a message arrives on a previously empty queue.

    2. On Linux (but not other UNIX implementations), POSIX message queues can be monitored using poll(), select(), and epoll(). System V message queues don’t provide this feature.