arXiv:2505.06546cs.OScs.RO2025-05中稿 · IEEE RTAS 2025

让回调直接绑定线程,突破中间件限制,提升实时系统调度效率

Work in Progress: Middleware-Transparent Callback Enforcement in Commoditized Component-Oriented Real-time Systems

  • 回调与线程一对一绑定,绕过中间件层,直接用操作系统参数控制
  • 无论回调多少,开销均低于多线程执行器,跨进程通信开销仅为1.4倍
  • 适合追求低延迟、高确定性的实时系统开发者,尤其在ROS 2中应用

在基于Linux的通用组件化实时系统(如ROS 2)中,传统嵌套调度机制同时涉及操作系统线程调度与中间件层调度(如ROS 2 Executor)。本文通过建立回调与操作系统线程之间持久的一一对应关系,可忽略中间件层,直接对每个回调应用操作系统调度参数(如调度策略、优先级、亲和性)。我们提出一种新的中间件模型,并实现名为CallbackIsolatedExecutor的新型ROS 2执行器。实验表明,无论回调数量多少,CallbackIsolatedExecutor的开销(用户态-内核态切换、上下文切换、内存使用)均低于MultiThreadedExecutor。且其相对于SingleThreadedExecutor的开销比保持固定:跨进程通信为1.4倍,同进程通信为5倍。未来可在不考虑中间件层的前提下开展ROS 2实时调度研究。

原文摘要 · Abstract (English)

Real-time scheduling in commoditized component-oriented real-time systems, such as ROS 2 systems on Linux, has been studied under nested scheduling: OS thread scheduling and middleware layer scheduling (e.g., ROS 2 Executor). However, by establishing a persistent one-to-one correspondence between callbacks and OS threads, we can ignore the middleware layer and directly apply OS scheduling parameters (e.g., scheduling policy, priority, and affinity) to individual callbacks. We propose a middleware model that enables this idea and implements CallbackIsolatedExecutor as a novel ROS 2 Executor. We demonstrate that the costs (user-kernel switches, context switches, and memory usage) of CallbackIsolatedExecutor remain lower than those of the MultiThreadedExecutor, regardless of the number of callbacks. Additionally, the cost of CallbackIsolatedExecutor relative to SingleThreadedExecutor stays within a fixed ratio (1.4x for inter-process and 5x for intra-process communication). Future ROS 2 real-time scheduling research can avoid nested scheduling, ignoring the existence of the middleware layer.

实时系统ROS 2调度优化中间件

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。