首页 > 系统相关 >Xenomai 进程间通信方式

Xenomai 进程间通信方式

时间:2023-05-05 11:01:37浏览次数:41  
标签:real RT domain socket 间通信 进程 time 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.

标签:real,RT,domain,socket,间通信,进程,time,Xenomai
From: https://blog.51cto.com/u_16097040/6245051

相关文章

  • 【解决办法】三层交换机通过静态路由和接口互联,实现不同VLAN间通信的两种方法
    环境:工具:锐捷EVE模拟器远程工具:SecureCRT系统版本:Windows10问题描述:描述:通过两台三层交换机的互联,完成全网互通。拓扑如下图:解决方法-视频与文字教程:视频教程:文字教程:方法1:通过建立TRUNK链路,通过SVI虚拟接口实现三层交换机的互联,各交换机下的终端的网关指向各自交......
  • /proc/xenomai/sched 里状态符号的意思
    $cat /proc/xenomai/schedCPU PID  CLASS PRI   TIMEOUT TIMEBASE STAT   NAME 0 0   idle  -1   -    master  R     ROOT/0参考include/xenomai/nucleus/thread.h:/*Mustfollowthedeclaratio......
  • Xenomai 的发展路线
    Xenomai最开始的理念就是提供一套方案来解决传统的实时API在Linux上的移植问题。目前已经支持了多平台和对多个OS的对应。目前的版本是Xenomai2,主要是实现了用户态下的实时支持。包括POSIX1003.1b和原生Xenomaiskin的支持以及内核下的RTDM(实时驱动模块的支持)这里要介绍的是Xenoma......
  • Xenomai在不同域中的优先级问题
    Firstexample:---------------------Supposethatatareschedulingwehavethefollowingthreadinthereadyqueues-HighPriority->LinuxthreadH-MediumPriority->XenomaithreadMinPRIMARYdomain-LowPriority->XenomaithreadLin......
  • Xenomai 设定中断亲和性
    Xenomai中如果想要把来绑定中断到对应的CPU上可以使用如下API,当然前提是你必须保证中断控制器提供对应的支持.比如将IRQ绑定到CPU1上:rthal_set_irq_affinity(IRQ_NUMBER,xnarch_cpumask_of_cpu(1));另外,只能在内核空间中调用上述的接口.关于中断亲和性,参考如下内容:http......
  • Xenomai thread migration
    Xenomai中的任务需要通过以下方式显示声明CPU迁移,否则系统不会主动进行迁移。原因是迁移本身会带来延迟,系统决定不去做迁移的判断。>Oristhereacomplexalgorithmtodeterminewhoisinaprocessorina>instance?Nocomplexalgorithmatall.AXenomaithreadis......
  • postgresql有进程链接数据时删除数据库
    selectpg_terminate_backend(pg_stat_activity.pid)frompg_stat_activitywheredatname='数据库名称'andpid<>pg_backend_pid();命令解释:pg_terminate_backend:用来终止与数据库的连接的进程id的函数。pg_stat_activity:是一个系统表,用于存储服务进程的属性和状态。pg_......
  • 查看Java进程启动的详细参数
    问题解决分析和定位一个Java线上系统问题,我们需要查看JVM启动时的一些参数设置,例如:垃圾回收算法、堆大小等等。这些参数可能在启动脚本中明确指明,也可能采用默认值。在系统运行过程中其他人也许动态调整了系统参数。通过jps命令找对对应的pid进程号[root@swk-207~]#ps-ef|......
  • 微服务 - Nginx网关 · 进程机制 · 限流熔断 · 性能优化 · 动态负载 · 高可用
    系列目录:微服务-概念·应用·通讯·授权·跨域·限流微服务-集群化·服务注册·健康检测·服务发现·负载均衡微服务-Redis缓存·数据结构·持久化·分布式·高并发本文的前提需要了解一些基础的Linux知识。以下围绕Nginx1.23的网关应......
  • linux进程的管理和调度 --- 调度相关
    进程调度含义进程调度决定了将哪个进程进行执行,以及执行的时间。操作系统进行合理的进程调度,使得资源得到最大化的利用。在单片机上,常常使用的方式是:系统初始化---->while(1){}。(当然,单片机也可以跑类似FreeRTOS,也可以有进程切换)在带操作系统的CPU上跑的逻辑是,允许多个进程(......