0

Background:

We have a clock process which needs to signal other non child processes[cpp code] on each clock tick. Each of the process lives in its on container (containerd).

Besides doing brute force of scanning a shared memory on a change(which is very bad in terms of computing resource). Any other effective ways for a near real-time system to send a signal for other processes?

Desired behavior:

  1. Make all process to sleep for a time x or until they received a tick single from the main clock
  2. The latency of each process should be small, less than a milisecond.

Questions:

Is it possible to wait_event_interruptible_timeout in the userspace. Will it help for the scenario above? Any other solution ?

oak
  • 2,898
  • 2
  • 32
  • 65
  • 1
    what about `select` and the successors? I expect your complete design is event driven... if not, you should split event driven from looping parts. – Klaus Jan 09 '22 at 16:17
  • 1
    Unix domain socket? – Wyck Jan 09 '22 at 16:19
  • 2
    The biggest problem here is that if ten C++ developers get asked what is "best practice for ", there will be at least eleven different answers in response. There are very few "best practices" in C++ which are founded in facts and citations; everything else is mostly opinion. – Sam Varshavchik Jan 09 '22 at 16:45
  • SO usage note: Avoid using syntax highlighting for non-code. In this case clock is generic, but `clock` has [a specific meaning](https://man7.org/linux/man-pages/man3/clock.3.html). signal would mean "Send some sort of message. I haven't decided on what yet" while `signal` means "I know [exactly what means of communication](https://man7.org/linux/man-pages/man2/signal.2.html) I wish to use." This leads to unnecessary ambiguity in the question. – user4581301 Jan 09 '22 at 17:51
  • @Klaus `select` and `pselect` can be an option. Is it possible to do `single writer` - `multireader` with `pselect`? – oak Jan 10 '22 at 18:53

0 Answers0