7

I have two processes A and B. A and B needs to communicate (Bi-directional) sometimes for passing signals, messages etc.
I have done some basic research about IPC's available in Linux like semaphore, message queues, dbus etc.
Now I am in confusion in deciding which one to use, Can anyone tell me which IPC is better to use for my application ?

Thanks in advance

Edited: Elaborating the Application. ( It is an Embedded Application )
Process A will be monitoring Temperature, speed calculation etc. Process B will be driving the motor, reading the sensor values (Numeric) etc. Sometimes I need to send the signal to process B telling Max temperature is reached, so stop driving motor. Sometimes needs to send the data read from sensor in Process A to Process B. Like this the Numeric data needs to be passed across process. And I am doing this in ARM Architecture.

duslabo
  • 1,487
  • 4
  • 20
  • 33

1 Answers1

16

Selection of IPC technique depends on application which you are trying to implement. Below is a good comparison base on performance:

IPC name      Latency     Throughput   Description
-----------------------------------------------------------------------------------------
Signal        Low          n/a         Can be used only for notification, traditionally-
                                       to push process to change its state

Socket        Moderate     Moderate    Only one mechanism which works for remote nodes,
                                       not very fast but universal

D-Bus         High         High        A high-level protocol that increases latency and
                                       reduces throughput compared to when using base
                                       sockets, gains in increased ease of use

Shared        n/a          High        Data saved in-between process runs(due to swapping
memory                                 access time) can have non-constant access latency

Mapped files  n/a          High        Data can be saved in-between device boots

Message      Low           Moderate    Data saved in-between process runs. The message
queue                                  size is limited but there is less overhead
                                       to handle messages

Here is one more nice comparison

Comparing Unix/Linux IPC

Community
  • 1
  • 1
Satish
  • 16,544
  • 29
  • 93
  • 149
  • 2
    Thanks for nice comparison, planning to use D-Bus for my application, I am worrying because of it's high latency. Mine is realtime application. – duslabo Feb 21 '13 at 01:17
  • 1
    the throughput section of D-bus says that "High", this should be low according to the description provided. – John Jun 11 '19 at 09:31
  • 1
    This table does not make sense for D-Bus. It says "reduces throughput compared to when using base sockets". Sockets are listed as "Moderate" througput so D-Bus must be "Moderate" or less. According to the description it can not be "High". – JaM Jul 01 '19 at 10:45