title: Receiving a specific message from POSIX Message Queue
body: <p>I am supposed to write a C application in Unix such that <code>N</code> children processes will be forked from the parent process and I will send messages to these children and children are supposed to send messages each other.</p>
  
  <p>However the problem is, I need to send messages to a specific target child process. i.e. parent will send to child 1, child 1 will send to child 2, ... and child <code>n</code> will send to <code>1</code> (circularly). </p>
  
  <p>The problem is, if I create only one message queue, any of <code>n</code> children may dequeue the message (since any of them may run after parent process due to kernel scheduler) therefore the message will be dequeued in wrong process!</p>
  
  <p>In my application, there will be max. 1 message in the queue at a time. The only solution comes to my mind is to create <code>n</code> different message queues and pass messages to appropriate queue so that a specific target process can receive it. But I think there must me a more legitimate solution.</p>
  
  <p>Any ideas?</p>
  
  <p>Contraints: Pipes between processes are not allowed, I know that mq is inefficient here. I'll also implement them, both are required. <em>P.S.</em> This is kinda homework (damn I am the creator of <a href="http://canyoudomyhomework.com" rel="nofollow">http://canyoudomyhomework.com</a>), however this is not just a homework, a challenging question IMHO.)</p>