Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use futex for IPC notifications #625

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Jul 4, 2024

This PR replaces the use of std::signal with futex for inter-process notifications between publishers and subscribers. improving the robustness and performance of IPC notifications. Tested on PC and c3x device.

Benefits:

  1. Futex provides a cleaner and more reliable synchronization mechanism than signals. Signals can interrupt system calls across all subscriber processes, adding complexity and impacting overall system performance.
  2. Futex minimizes context switches and eliminates signal handler overhead, thereby reducing synchronization latency. It primarily operates in user space and enters kernel space only when necessary, unlike std::signal, which always involves kernel space operations.
  3. Futex provides a more reliable and easier-to-debug synchronization mechanism than signals, ensuring robust inter-process communication.

@deanlee deanlee changed the title use futex futex for IPC notification use futex for IPC notification Jul 4, 2024
@deanlee deanlee force-pushed the use_futex branch 2 times, most recently from 31dc7cd to 38226b1 Compare July 4, 2024 12:12
@deanlee deanlee force-pushed the use_futex branch 3 times, most recently from 16cdf35 to fcfbc2a Compare July 4, 2024 14:53
@deanlee deanlee changed the title use futex for IPC notification use futex for IPC notifications Jul 4, 2024
@deanlee deanlee force-pushed the use_futex branch 3 times, most recently from d689766 to 9a1c2cc Compare July 4, 2024 17:28
@adeebshihadeh
Copy link
Contributor

This is a pretty core change to msgq. I'd like to do it, but we need to make sure that it hits all of our goals. Fixing the EINTR spam is great, but let's also make sure it'll work on macOS.

@deanlee deanlee marked this pull request as draft August 16, 2024 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants