Alex Rivera | Logout

What are the disadvantages of Linux's message queues?

Asked 2012-03-05T07:11:16.070
15

I am working on a message queue used to communication among process on embedded Linux. I am wondering why I'm not using the message queues provided by Linux as following:

msgctl, msgget msgrcv, msgsnd.

instead of creating shared memory, and sync up with semaphore?

What's the disadvantage of using this set of functions directly on a business embedded product?

Edit
Report

1 Answer

1

The disadvantages message queues are miniscule - some system call and copying overhead - which amount to nothing for most applications. The benefits far outweigh that overhead. Synchronization is automatic and they can be used in a variety of ways: blocking, non-blocking, and since in linux the message queue types are implemented as file descriptors they can even be used in select() calls for multiplexing. In the POSIX variety, which you should be using unless you have a really compelling need to use SYSV queues, you can even automatically generate threads or signals to process the queue items. And best of all they are fully debugged.

answered 2012-03-05T08:14:39.817

Your Answer