IPC via messages

In QNX a message is a packet of bytes that is synchronously transmitted from one process to another. QNX attaches no meaning to content of a message. To communicate directly with one another, cooperating processes use these C language functions:

These functions can be used locally or across the network.

Next picture illustrates outlines a simple sequence of events in which two processes, Process A and Process B, use Send(), Receive(), and Reply()to communicate with each other:

  1. Process A sends a message to Process B by issuing a Send() request to the Kernel. At this point, Process A becomes SEND-blocked until Process B issues a Receive() to receive the message.
  2. Prtocess B issues a Receive() and receives Process A's waiting message. Process A changes to a REPLY-blocked state. Since a massege was waiting, Process B does not block.
    If Process B has issued the Receive() before a message was sent, it would become RECEIVE-blocked until a message arrived. In this case, the sender would immediately go into the REPLY-blocked state when it sent its message.
  3. Propcess B completes the processing associated with the message it received from Process A and issues a Reply(). The reply message is copied to Process A, which is made ready to run. A runs depends on the relative priorities of Process A and Process B.

Blocked states

When a process is not allowed to continue executing, because it must wait for some part of the message protocol to end, the process is said to be blocked. The following table summarizes the blocked states of processes:

If a process has issued a: the process is:
Send() request, and the message it has sent has not yet received by the recipient process SEND-blocked
Send() request, and the message has been received by the recipient process, but that process has not yet replied REPLY-blocked
Receive() request, but has not yet received a message RECEIVE-blocked

Advanced facilities

The QNX provides these advanced massage-passing facilities:

Reserved message codes

Quantum begins all of its messages with a 16-bit word called message code. Note that Quantum's system processes use message codes in the following ranges:

0x0000 to 0x00FF Process Manager messages
0x0100 to 0x01FF I/O messages (common to all I/O services)
0x0200 to 0x02FF Filesystem Manager messages
0x0300 to 0x03FF Device Manager messages
0x0400 to 0x04FF Network Manager messages
0x0500 to 0x0FFF Reserved for future Quantum system processes