UDP vs Message Queue

I want to check the efficiency of UDP and message queue for IPC in POSIX.
I want to develop two applications . Each application is remote to each other and are exactly similar. Each application consists of several processes. Now for remote communication…UDP is better but for local IPC means communication between processes in same application…which is better Message queue or UDP???
Which one would be better and why?

You should really try it for yourself. Because not everybodys definition of better is the same. For example with UDP you dont get reliability, which message queue provides. You could use TCP instead. UDP works fine locally.

You could write yourself a cover library that would transparently support both method, depending on which one works best in your environment, for example message queue remotely and UDP locally or even a third method which would be using QNET, probably the best of all method. I realize you mentioned POSIX but using cover functions/library will help you make the program portable.

In QNX there are two implementations of message queue, one is meant for local usage and is very fast. The other method, which is slower works remotely and locally. A program can`t use both method at the same time.

I think you should forget about efficiency of UDP vs. IPC as the determining factor. IPC within a CPU is almost always going to be low overhead either way. Instead decide whether this is an application that is intended for QNX or whether you plan to port it. Best of all, as Mario suggests, hide this issue behind a software layer so if you need to port, it is easy.

U have suggested to use Message Queue for remote calls and UDP for local calls. IF I can’t use QNet , I searched I can communicate remotely through Message Queue with the help of Qnet…Otherwise I have to go with POSIX implementation of Message queue. I Want to save net calls that’s why I want to use something else(except UDP) for local calls and UDP for remote calls.
Can u suggest some example which would help to embed message queue for local IPC and UDP for remote calls?


I do not know what your background is but you assumption about “saving net calls” is wrong. Under QNX there isn’t that big of a difference in using UDP and message queue for local IPC.

I suggested you experiment first before taking a decision because it seems to me your decision will based on your knowledge of other OSes and it may no apply to QNX.