我有两个进程A和B。有时,A和B需要通信(双向的)以传递信号、消息等。
我已经对Linux中可用的IPC进行了一些基础研究,如信号量、消息队列、dbus等。
现在我在决定使用哪个IPC时很困惑,有人能告诉我哪个IPC更适合我的应用程序吗?
提前感谢
编辑:阐述应用。(这是一个嵌入式应用程序)
过程A将监测温度,速度计算等。过程B将驱动电机,读取传感器值(数字)等。有时我需要发送信号到进程B告诉最高温度,所以停止驱动电机。有时需要将从A进程中的传感器读取的数据发送到进程B。像这样,数字数据需要跨进程传递。我是在ARM架构中这么做的。
发布于 2013-02-20 17:38:52
IPC技术的选择取决于您要实现的应用程序。下面是一个很好的基于性能的比较:
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这是另一个很好的比较
https://stackoverflow.com/questions/14985999
复制相似问题