
Linux System Programming Techniques
By :

Another popular IPC technique is message queues. It's pretty much what the name suggests. A process leaves messages in a queue, and another process reads them.
There are two types of message queues available on Linux: System V and POSIX. In this recipe, we'll cover POSIX message queues since these are a bit more modern and simpler to handle. POSIX message queues are all about using the mq_
functions, such as mq_open()
, mq_send()
, and so on.
Knowing how to use message queues enables you to choose from among a variety of IPC techniques.
For this recipe, we'll only need the GCC compiler and the Make tool.
In this recipe, we'll create the sender program. It's this program that will create a new message queue and some messages to it. In the next recipe, we'll receive those messages:
msg-sender.c
. Since there...