Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multicast IPC options in unix

Tags:

unix

ipc

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).

like image 219
Jake Avatar asked Feb 28 '15 00:02

Jake


1 Answers

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.

like image 73
pilcrow Avatar answered Oct 23 '22 14:10

pilcrow