IPC Mechanisms (ROS1 vs Shared Memory IPC)

IPC Mechanisms (ROS1 vs Shared Memory IPC)

Introduction

Inter-Process Communication (IPC) mechanisms are fundamental to modern operating systems, enabling different processes to communicate and synchronize their actions while running concurrently. These mechanisms are crucial for ensuring efficient data exchange and coordination in complex software systems. Common IPC methods include sockets, which facilitate network-based communication; message queues, which manage data exchange in a queued manner; and shared memory, which allows multiple processes to access the same memory space directly.

This summer (2024), as part of the OMSCS program at Georgia Institute of Technology , I enrolled in a graduate-level course on operating systems (CS-6200). This course provided me with a comprehensive understanding of these IPC mechanisms and their practical applications. Prior to the course, I had experience with ROS1 (Robot Operating System), but the class revealed that ROS1's communication methods are not the most efficient. Motivated by this insight, I decided to conduct an experiment to evaluate the communication overhead of transferring a point cloud consisting of one million points between processes.


Experiment

To assess the communication efficiency of various Inter-Process Communication (IPC) mechanisms, I selected three distinct types of nodes for the experiment:

  1. ROS1 (rospy) Publisher and Subscriber.
  2. ROS1 (roscpp) Publisher and Subscriber.
  3. Shared Memory IPC Writer and Reader.

In this experiment, the focus was solely on the communication performance, so the preparation of the point cloud message was excluded to ensure that the comparison was purely based on the communication overhead.

Latency measurements were conducted by averaging the results from 1,000 message transfers for each node type.

Results

The average latency for each mechanism is summarized in the table below:

Analysis

  1. ROS1 (rospy): The average latency for the rospy implementation of ROS1 was 57.2 ms. This reflects the inherent communication overhead when using Python-based ROS1 nodes, which are typically slower compared to their C++ counterparts.
  2. ROS1 (roscpp): The roscpp implementation exhibited an average latency of 36.1 ms. As expected, the C++-based ROS1 nodes demonstrated better performance than the Python-based nodes, highlighting the efficiency of C++.
  3. Shared Memory: The shared memory IPC mechanism showed a significantly lower average latency of 0.048 ms. This result underscores the efficiency of shared memory for inter-process communication, as it minimizes (almost eliminates) overhead by allowing direct access to memory rather than involving additional layers of communication.


In summary, the shared memory IPC mechanism outperformed both rospy and roscpp in terms of latency, making it the most efficient method for communication between processes in this experiment. The data indicates that for scenarios requiring minimal latency, shared memory is a preferable choice over ROS1-based communication methods.


Github link:

References


Youssef Desouky ????

Robotics Software Engineer at Tahaluf | C++ | ROS | Qt | DDS

7 个月

Great work. What was the size of the point cloud msg? Also was there any size limitation on the IPC methods used?

回复
Abdalrahman Ibrahim

AI Lead Engineer at AGILOX: Driving the Future of Intralogistics with AI-Powered Robotics

7 个月

Thank you for your work, wishing you the best with upcoming semester, also we are looking forward for the ROS2 comparison ?

Ahmed Magdy

MBD | Embedded Systems | Control Theory | Automotive | Robotics | Medical Devices | Localization | SLAM | Autonomous Navigation | ROS

7 个月

Congratulations! ????

Hassan Umari

Software Development, Robotics, Mechatronics

7 个月

Very interesting, thanks for sharing. ROS 2 uses DDS which supports communication over shared memory (message I think has a size limit though).

要查看或添加评论,请登录

Ahmed Radwan的更多文章

  • Self-hosting - Part 2 - Jellyfin

    Self-hosting - Part 2 - Jellyfin

    Missed Part 1? Check it out here. A year ago, I became a parent, and like many others, I’ve been thinking about how to…

    2 条评论
  • Self-hosting - Part 1 - Immich

    Self-hosting - Part 1 - Immich

    Disclaimer: My current setup isn't perfect and can be done in a better and more optimized way. I chose to do it this…

    4 条评论
  • LIO-SAM on Yonohub

    LIO-SAM on Yonohub

    We are pleased to announce the release of LIO-SAM Mapping ready-to-use Block on YonoArc. You can use the block to…

  • AirSim with Autoware

    AirSim with Autoware

    As illustrated in our previous articles(Autoware.ai Vision & Autoware.

    5 条评论
  • Autoware on Yonohub (Vision pipeline) — Part 3

    Autoware on Yonohub (Vision pipeline) — Part 3

    This article is part of the Autoware series. Check out the full series: Part 1, Part 2 We are pleased to announce the…

  • Autoware on Yonohub — Part 2

    Autoware on Yonohub — Part 2

    We are pleased to announce the release of Autoware Localization and Perception blocks on Yonohub. With these blocks…

    9 条评论
  • Autoware on Yonohub?-?Part?1

    Autoware on Yonohub?-?Part?1

    We are pleased to announce the release of AutowareAI ready-to-use environment on Yonohub. With this environment, you…

  • Waymo Open Dataset Player on Yonohub

    Waymo Open Dataset Player on Yonohub

    Introduction Waymo is well-known for their development in autonomous vehicles since 2009 and in 2017 they started a…

    13 条评论

社区洞察

其他会员也浏览了