Proper use of the message queue in POSIX

I am very confused about using message queues in real time OS. The code that was provided seems to have message queues used to the bone: even passing variables to another class object is done through MQ. I always have the MQ concept used in IPC. Question: what is the correct use of message queue?

+3
source share
2 answers

In real-time OS environments, you often face the problem that you must guarantee that code runs on a fixed schedule. For instance. you can get a function that gets exactly every 10 milliseconds. Not earlier, not later.

To guarantee such strict time limits, you need to write code that should not block the critical time code under any circumstances.

You cannot use posix synchronization primitives here. You should never block a mutex or aqurie semaphore from a critical time code, because another process / thread may already block it. However, often you are allowed to unblock another thread from a critical time code (for example, freeing a semaphore in order).

In such environments, message queues are a good choice for data exchange because they offer a clean way to transfer data from one stream to another without blocking.

, . , .

, . , , , . .

+7

IPC, . . :
, . . , . , . , , , .

, .

0

All Articles