进程间通信

发布于 2024-10-08 01:52:11 字数 176 浏览 0 评论 0原文

我有4个进程,说p1.p2,p3,p4 ..进程p1必须向p2发送一个信号,表明它已获得init,并且该信号必须被p2捕获,然后它必须获得init ...并且p3和p4进程有要在初始化后从 p2 获取信号,那么这些进程必须进行初始化......

你可以建议执行此操作的逻辑或者如果可能的话示例代码

提前致谢

i have 4 processes say p1.p2,p3,p4..process p1 has to send a signal to p2 that it got init and that signal has to catch by p2 then it has to get init ...and p3 and p4 process has to get signal from p2 after its init then these process has to get init.........

can u suggest the logic in doing this or if possible sample code

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感悟人生的甜 2024-10-15 01:52:11

比如说,你有 1、2、3、4。那么:

  • 1-init->2
  • 2-init->3,4

对吧?

我会直接发送信号。你的问题出在哪里?
在 C 中,您必须包含 signal.h 并必须为所需信号(例如 SIGUSR1)指定处理程序子例程。

Say, you have 1,2,3,4. Then:

  • 1-init->2
  • 2-init->3,4

Right?

I would just directly send signals. Where is your problem?
In C you have to include signal.h and have to specify a handler subroutine for required signal (e.g. SIGUSR1).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文