suppose there are 2 threads and there are 2 message queues per thread.
note: every receive is blocking call

1st threads send a message to queue2, waits for response on queue3,
2nd thread first waits on queue2 and after receiving sends response to

then again 2nd thread sends a message to queue1 and waits for response on queue4.
1st thread then receives from queue1 and sends response to queue4.
so every thread has 2 queues one from which it receives the message and the other to receive response
if i increase the threads to more than 2 then this situation leads to deadlock....any logic so that it is scalable to any number of threads..semaphores may b used if required.