In reply to rgarcia07:
In your original example, the foreach statement executes as a single process. In your second example, a fork-join with a single statement behaves the same as begin/end.
You need to use fork-join_none to spawn independent processes.
initial begin
channel= new(); //creating mailbox
prod= new[4]; // create dynamic array of producers
foreach(prod[i])
prod[i] = new(channel); //passing mailbox handle to each producer
cons= new(channel); //passing mailbox handle
foreach(prod[i])
fork
automatic int k=i;
prod[k].run();
join_none
cons.run();
end