Best communication method to thousand childs?
I am doing a project in which i have a father, that can have several children. From time to time i have to send a command to one of the children.
I can do this in several ways, but i want to learn a bit more, so i want to do it a way which is efficient, even if there are thousands of children.
Method 1: One pipe to each child. Very fast, but takes up resources (and seems to me limited to 510 pipes)
Method 2: Shared memory in which i place the child name. father unlocks a semaphore, and all children read from shared memory, the one that finds it's name in the memory segment executes the command also placed in the memory. Very low constant memory usage (only one shared memory segment), but a peak in memory usage because all the children will try to access the memory at the same time.
Method 3: One pipe to whom's exit is available to all the children. when father puts a message in the pipe it sends a signal to the child it is intended for, so that that child and only that one reads from the pipe. Very low constant memory usage, but i fear that if the messages are to many it slows down the computer because of to many signals beeing sent(my interpretation of signals is that they almost freeze to computer, so sending the in rapid succession takes up lot's of resources).
I am mostly divided between Method 1 and 3. It seems 1 is better if there are many commands, while 3 is better for larger number of children and not so many commands.
I would like opinions, as to my conclusions are correct or not, and which method you would use if there were thousands of children .