*In reply to Srini @ CVCblr.com:*I agree with Srini’s comments: uvm_sequencer does exactly what you are looking for. But if you need to get this working without the UVM, the general algorithm is in this pseudo-code:
forever begin : forever_loop
foreach (queue[i] or mailbox[i]) begin : wait_loop
fork a process that blocks with wait(q[i].num >0) or mailbox[i].peek;
#0 make sure all forks have started so that they can be killed
kill all other processes that are blocked
end : wait_loop
wait fork;
foreach (queue[i] or mailbox[i]) begin : arb_loop
pick the producer to service
end : arb_loop
end :forever_loop