Multicast IPC options in unix

痴心易碎 提交于 2019-12-10 17:46:33

问题


Among the following list of IPC options, which could perform multicast (i.e. 1 sender and multiple receivers):

  • signals
  • half duplex pipe
  • named pipe
  • system V message queue
  • unix domain socket

Edit

  • memory mapped files

From my understanding, it might be possible with named pipe (not sure).


回答1:


There's nothing as conceptually flexible as multicast, but with a few limitations some of the facilities might do what you want.

Signals may be delivered to a process group. The other IPC mechanisms you list have a sender/receiver model and are not suitable for multicast, barring local extensions like Linux's multicast AF_UNIX sockets as @Barmar points out in the comments.

If you only need to send a single "signal" to descendant processes, and only once, you may use an inherited fifo. All receivers inherit the read end of the fifo but not the write end. The process holding the write end closes it at some point, and all receivers will detect EOF on their read end copies.



来源:https://stackoverflow.com/questions/28776694/multicast-ipc-options-in-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!