Inter-process communication for real-time

For my Arm9 board, my application will have 2 or 3 processes or maybe threads and one of ( pipe, socket, fifo, msg queue or shared memory, or?) to pass data between them. The data is about 100bytes every 50ms. Assuming I just have vanilla Linux or uCLinux without any real-time enhancements, which of the above methods will have the least processor overhead, so as to be a bit closer to meeting real-time deadlines?

My guess is that pthreads with shared memory might be best, but maybe not.

Reply to
tns1
Loading thread data ...

On ARM you should use one process with more than one thread for this job. Changing between processes hurts the ARM CPU as it needs to throw away its cache content for *each* change (cache works on virtual address lines instead physical ones)! For example on an Xscale running at ~500MHz you can wake up one process in your system every 100us (with HRT and RT Preempt). But with only one additional process in the system it does not work anymore. The time increases to 300us ... 500us (changing priority in this case does not help, as this is a hardware restriction).

JB

Reply to
Juergen Beisert

So what about sharing data between the threads? In the past I have used message queues, but I suspect they use more processor time than say, a shared memory or pipe. I'd like to start off with the right architecture since I don't have time to test all the possible configurations.

Reply to
tns1

Sharing data between threads is always the most efficiency way. The POSIX message queues are also part of the POSIX realtime library. But: Don't use the IPC implementations of sharing memory and message queues!

Note: To benefit from the new kernel features you need a very recent EABI toolchain for ARM. OABI toolchains do not help.

JB

Reply to
Juergen Beisert

If you can accept a "might be best" solution, this is soft realtime and not hard realtime. Thus you are fine with Linux.

If you need a "must happen before..." solution this is hard realtime and Linux will not suite you.

-Michael

Reply to
Michael Schnell

This is true for "full" MMU Linux. If you use µCLinux, this ARM problem is not triggered and the (soft) realtime performance will be better.

-Michael

Reply to
Michael Schnell

Of course with µCLinux sharing data between processes is really simple :).

-Michael

Reply to
Michael Schnell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.