Xenomai 进程间通信方式

Xenomai 进程间通信方式分成Xenomai域内的IPC以及Xenomai域和Linux域之间的IPC,

目前采用的rtipc(RTDM驱动)的方式,主要是给用户空间提供socket接口,实时应用

通过调用对应的接口可以避免切换到Linux域而导致实时性降低。rtipc对应了三个协议:

XDDP (Xenomai域和Linux域之间的IPC)

IDDP和BUFP (Xenomai域内的IPC)

另外,原有的RT_PIPE机制仍旧支持,但从Xenomai 3开始就不支持了。

http://www.xenomai.org/pipermail/xenomai/2009-September/017631.html

In the wake of a recent discussion about Xenomai 3, the requirement to
find a substitute for the native message pipes interface (i.e. RT_PIPE)
was pointed out.

The real-time side of this new interface would have to be available from
kernel space to RTDM drivers as well, so that people adopting a clean
split model like RTDM-drivers <-> userland applications, would not be
left in the cold, with no replacement for the legacy RT_PIPE API in
kernel space, which will be phased out in Xenomai 3.

This question, and a few others, may have found an answer with the
recent merging of the so-called RTIPC framework, for Xenomai 2.5.x.
RTIPC is an RTDM-based "meta-driver", on top of which one may stack
protocol drivers, exporting a socket interface to the real-time users,
running in primary mode within the Xenomai domain. The point of RTIPC
being precisely that such users won‘t want to leave the real-time mode
for sending/receiving data to/from other destinations/sources.

So far, I have merged three protocols along with the RTIPC framework,
namely XDDP, IDDP and BUFP.

* XDDP stands for "cross-domain datagram protocol", i.e. to exchange
datagrams between the Xenomai (primary) real-time domain, and the Linux
realm. This is what the message pipe fans may want to have a look at.
Basically, it connects a real-time RTDM socket to one of the /dev/rtp*
pseudo-devices. The network port used on the socket side matches the
minor device number used on the non RT side. The added bonus of XDDP is
that people relying on the POSIX skin may now have access to the message
pipe feature, without dragging in bits of the native skin API for that
purpose.

* IDDP stands for "intra-domain datagram protocol", i.e. a
Xenomai-to-Xenomai real-time datagram channel. This protocol may not be
as flexible as POSIX message queues (does not support message priority
but does out-of-bound sending though), but exports a socket interface,
which is surely better for your brain than mq_*() (ask Gilles). The
basic idea behind it is that anything you could do based on AF_UNIX
sockets in the Linux realm, should be (mostly) doable with AF_RTIPC+IDDP
in the Xenomai domain. However, we use numeric port numbers or label
strings, and not socket paths to bind sockets in the Xenomai namespace.

* BUFP stands for "buffer protocol", probably the most naive of all, but
likely the best fit when you don‘t care for message boundaries, and just
want an efficient IPC to send a byte stream from a producer to a
consumer thread, without leaving the Xenomai domain. This protocol is
the exact equivalent of the RT_BUFFER API that came to light earlier in
the 2.5.x series, but again, exporting a socket interface to the
real-time application.

The fact that all RTIPC protocols are RTDM-based, means that one can
reach the socket API from kernel space as well, using the inter-driver
RTDM interface, see:
http://www.xenomai.org/documentation/xenomai-head/html/api/index.html

参考示例:

http://www.rts.uni-hannover.de/xenomai/lxr/source/examples/rtdm/profiles/ipc/

* Real-time Xenomai threads and regular Linux threads may want to

* exchange data in a way that does not require the former to leave

* the real-time domain (i.e. secondary mode). Message pipes - as

* implemented by the RTDM-based XDDP protocol - are provided for this

* purpose.

*

* On the Linux domain side, pseudo-device files named /dev/rtp<minor>

* give regular POSIX threads access to non real-time communication

* endpoints, via the standard character-based I/O interface. On the

* Xenomai domain side, sockets may be bound to XDDP ports, which act

* as proxies to send and receive data to/from the associated

* pseudo-device files. Ports and pseudo-device minor numbers are

* paired, meaning that e.g. port 7 will proxy the traffic for

* /dev/rtp7. Therefore, port numbers may range from 0 to

* CONFIG_XENO_OPT_PIPE_NRDEV - 1.

*

* All data sent through a bound/connected XDDP socket via sendto(2) or

* write(2) will be passed to the peer endpoint in the Linux domain,

* and made available for reading via the standard read(2) system

* call. Conversely, all data sent using write(2) through the non

* real-time endpoint will be conveyed to the real-time socket

* endpoint, and made available to the recvfrom(2) or read(2) system

* calls.

其他相关的说明:

https://www.mail-archive.com/[email protected]/msg04535.html

XDDP is a wrapper over Xenomai‘s message pipe support, offering a socket-based interface to applications. Each XDDP port is mapped to a
given /dev/rtp device minor, but the communication endpoints between RT
and NRT are different internally.

[XDDP-port] <---> xnpipe #<port>
                     ^
                     |
                     |  * input queue:  /dev/rtp -> xnpipe
                     |  * output queue: xnpipe -> /dev/rtp
                     |
                     v
               /dev/rtp<port>

So, when NRT reads from /dev/rtp<port>, it does not actually listen to the same endpoint/queue than RT, because message pipes are
bi-directional. Likewise, NRT and RT never write to the same queue,
since the purpose of message pipes is to cross the RT/NRT domain boundary. 

Xenomai 进程间通信方式,布布扣,bubuko.com

时间: 2024-10-11 05:19:38

Xenomai 进程间通信方式的相关文章

【转】进程间通信方式总结(windows 和linux)

平时看的书很多,了解的也很多,但不喜欢总结,这不昨天面试的时候被问到了进程间通信的方式,因为没有认真总结过,所以昨天答得不是特别好.现在将linux和windows的进程间通信方式好好总结一下. windows的进程间的通信方式有1.文件映射:2. 共享内存(是文件映射的一种特殊情况):3.邮件槽(mailslot)(点对点消息队列); 4.匿名管道:5:命名管道: 6. 剪贴板:7.动态数据交换:8.对象链接与嵌入:9.远程过程调用:10.动态链接库:11.socket:12.WM_COPYD

进程间通信方式

1.进程间通信方式 (1)windows进程间通信方式 1.文件映射: 2.共享内存(是文件映射的一种特殊情况): 3.邮件槽(mailslot)(点对点消息队列); 4.匿名管道: 5.命名管道: 6.剪贴板: 7.动态数据交换: 8.对象链接与嵌入: 9.远程过程调用: 10.动态链接库: 11.socket: 12.WM_COPYDATA. (2)linux进程间通信方式 1.管道 2.信号量 3.共享内存 4.消息队列 5.套接字 6.信号 (3)windows和linux共有的进程间通

转:进程间通信方式

这部分参考文献2:详细内容打开链接看 程序员必须让拥有依赖关系的进程集协调,这样才能达到进程的共同目 标.可以使用两种技术来达到协调.第一种技术在具有通信依赖关系的两个进程间传递信息.这种技术称做进程间通信(interprocess communication).第二种技术是同步,当进程间相互具有合作依赖时使用.这两种类型的依赖关系可以同时存在. 一般而言,进程有单独的地址空间.我们可以了解下可执行程序被装载到内存 后建立的一系列映射等理解这一点.如此以来意味着如果我们有两个进程(进程A和进程B

linux进程间通信方式及比较

进程间的通信方式: 1.管道(pipe)及有名管道(named pipe): 管道可用于具有亲缘关系进程间的通信,有名管道除了具有管道所具有的功能外,它还允许无亲缘关系进程间的通信. 2.信号(signal): 信号是在软件层次上对中断机制的一种模拟,它是比较复杂的通信方式,用于通知进程有某事件发生,一个进程收到一个信号与处理器收到一个中断请求效果上可以说是一致得. 3.消息队列(message queue): 消息队列是消息的链接表,它克服了上两种通信方式中信号量有限的缺点,具有写权限得进程可

进程间通信方式总结

进程间通信就是在不同进程之间传播或交换信息,那么不同进程之间存在着什么双方都可以访问的介质呢?进程的用户空间是互相独立的,一般而言是不能互相访问的,唯一的例外是共享内存区.但是,系统空间却是"公共场所",所以内核显然可以提供这样的条件.除此以外,那就是双方都可以访问的外设了.在这个意义上,两个进程当然也可以通过磁盘上的普通文件交换信息,或者通过"注册表"或其它数据库中的某些表项和记录交换信息.广义上这也是进程间通信的手段,但是一般都不把这算作"进程间通信&

linux 进程间通信方式

管道: 它包括无名管道和有名管道两种,前者用于父进程和子进程间的通信,后者用于运行于同一台机器上的任意两个进程间的通信消息队列: 用于运行于同一台机器上的进程间通信,它和管道很相似,是一个在系统内核中用来保存消息的队列,它在系统内核中是以消息链表的形式出现.消息链表中节点的结构用msg声明.共享内存: 共享内存是运行在同一台机器上的进程间通信最快的方式,因为数据不需要在不同的进程间复制.通常由一个进程创建一块共享内存区,其余进程对这块内存区进行 读写.得到共享内存有两种方式:映射/dev/mem

项目中遇到的进程间通信方式

1)socket:经常遇到,不讲了 2)信号:使用kill发送信号,signal,settimer等系统调用都能对另一个进程发送信号,达到了进程间通信的目的. kill(p1,16);    /*向进程号为p1的进程 发中断信号16*/ signal(SIGINT,go); /*接收到SIGINT信号后,转go函数去处理它*/ 3)共享内存:使用mmap系统调用能够做到共享内存,mmap的使用方式是以fd为入参,两个进程都打开一个文件名,并用mmap将这个fd映射到各自的进程环境,使用mmap反

进程间通信(4)---最高效的进程间通信方式--内存共享

内存共享   内存共享,它也是一种进程间通信的方式,它是在虚拟地址空间中堆和栈地址空间的中间的共享映射区中开辟一块地址,然后由页表和mmu在物理内存中开辟一段空间,其他进程如果获取到了这个内存的ID便可以和另外的进程共享这段内存. 内存共享的特点:高效,它比其他的进程间通信的方式都要高效因为它直接看到的就是相当于他自己的一块内存.  要用到的函数: int shmget(key_t key, size_t size, int shmflg);//创建共享内存 void *shmat(int sh

进程间通信方式及特点

1.管道 无名管道是一种只用于父子进程间的半双工的通信方式.有名管道是可以在无亲缘关系进程间通信. 2.信号量 用来控制多进程或多线程对共享资源的访问,是一种多进程和多线程之间同步的手段. 3.信号 用来通知接收进程某个事件已经发生. 4.共享内存 共享内存就是映射一段其它进程能被多进程访问的内存.它是进程间通信最快的方式,通常配合信号量等实现进程间的同步与通信. 5.套接字 用于不同进程之间通信.