Thread: Best communication method to thousand childs?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    35

    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 .

    Thank You
    Last edited by Ironic; 11-07-2008 at 10:53 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 05-05-2009, 04:53 PM
  2. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  3. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 07:01 AM
  4. Delegate Calling a method that Calls a delegate.
    By xddxogm3 in forum C# Programming
    Replies: 2
    Last Post: 05-05-2008, 12:59 AM
  5. help with threads communication
    By BrownB in forum C++ Programming
    Replies: 3
    Last Post: 05-23-2006, 03:37 AM