in reply to Tasking children from a single pipe

This is a classic case for using UDP. Have each child listen on the same UDP socket. Send the request to the socket (all in one write). One UDP listener will get the task.
  • Comment on Re: Tasking children from a single pipe

Replies are listed 'Best First'.
Re^2: Tasking children from a single pipe (packets)
by tye (Sage) on Mar 15, 2006 at 22:37 UTC

    Note that this requires that your UDP packet doesn't get fragmented, I think.

    And you can use the same technique with a single pipe. You need to make sure your writes don't get fragmented so you have to keep each task description under the "system buffer size", typically 4KB, I believe.

    Don't use <$handle> read the tasks, use read or sysread instead. You can write the tasks with print if you use a single print statement and have auto flushing turned on or you can use syswrite to be more explicit about the atomic nature you desire.

    - tye        

      Correct. I think the OP implied that the requests were a line at a time. You are also correct about sysread/syswrite etc. It is actually quite simple, despite all the caveats.