解决跨进程消息生命周期管理难题,实现零拷贝通信的高效安全
ipc_shared_ptr: A Publish/Subscribe-Aware Smart Pointer for Cross-Process Object Lifetime Management

- 设计专用智能指针,利用发布订阅结构特性优化引用计数
- 单写者模式下端到端延迟降低2.9倍,200个话题仍保持低延迟
- 适合高实时性系统,如自动驾驶开源项目Autoware
ROS 2等发布/订阅中间件中的真正零拷贝通信,要求订阅者引用发布者共享内存中的消息对象。对象在被引用期间不可回收,但最终必须回收,且需正确处理崩溃恢复和瞬时本地QoS保留。本文提出ipc_shared_ptr,一种面向发布/订阅的跨进程对象生命周期管理智能指针。该方法利用发布/订阅结构特性,对Birrell引用列表进行优化,将全局元数据更新限制为每订阅者0→1状态转换,使全局通信量降低一个数量级。分析关键元数据管理权衡:所有者驱动回收具有更高可扩展性,但并发成员变更与回收决策会产生竞争,扩大正确性验证状态空间;单写者模式实现结构原子性,消除复杂性但引入中心化瓶颈。iceoryx2(所有者驱动回收)与Agnocast——一个真实零拷贝ROS 2 IPC中间件,与发布者共享堆内存并采用ipc_shared_ptr的单写者模式——分别体现两种架构。在最大开源ROS 2应用Autoware规模下的对比评估表明,单写者模式已具备足够可扩展性:200个话题、每话题两个订阅者、100 Hz条件下,Agnocast端到端延迟p99.9比iceoryx2低2.9倍,证明实现简单性优于所有者驱动回收。
原文摘要 · Abstract (English)
True zero-copy Inter-Process Communication (IPC) in publish/subscribe (pub/sub) middleware such as Robot Operating System 2 (ROS 2) requires subscribers to reference message objects in publisher-owned shared memory. Objects must not be reclaimed while referenced, yet must eventually be reclaimed, with correct handling of crash recovery and Transient Local QoS retention requirements. We propose ipc_shared_ptr, a pub/sub-aware smart pointer for cross-process message lifetime management. ipc_shared_ptr exploits pub/sub structural properties to specialize Birrell's reference listing, limiting global metadata updates to per-subscriber 0<->1 transitions and achieving an order-of-magnitude reduction in global communication over general-purpose distributed reference counting. We analyze the key metadata management tradeoff: scalability versus implementation simplicity. Owner-driven reclaim offers greater scalability, but concurrent membership changes and reclamation decisions produce races that widen the correctness-verification state space. Single-writer achieves structural atomicity, eliminating this complexity at the cost of a centralized bottleneck. iceoryx2 (owner-driven reclaim) and Agnocast -- a true zero-copy ROS 2 IPC middleware sharing the publisher's heap with subscribers and adopting ipc_shared_ptr with single-writer -- embody each architecture. Comparative evaluation at the scale of Autoware -- the largest open-source ROS 2 application -- confirms that single-writer achieves sufficient scalability: at 200 topics, two subscribers per topic and 100 Hz, Agnocast's E2E p99.9 is 2.9x lower than iceoryx2's, justifying implementation simplicity over owner-driven reclaim.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。