On Sun, May 1, 2016 at 12:59 PM, Jianghui Geng <[email protected]> wrote:

> Sometime we submit multiple ‘parallel’ runs, such as
>
> parallel A ::: a b
> parallel B ::: c d
>
> We hope B can wait if A have already occupied all CPUs. However, it’s not the 
> case. It seems that B does not know the presence of A, and will thus 
> ‘compete’ for the CPU resources with A. How can I resolve this problem? I 
> just want B to wait until A has released CPUs.

sem --id /tmp/waituntildone  parallel A ::: a b &
sem --id /tmp/waituntildone  parallel B ::: c d

This will run only one parallel at a time. sem is an alias for
parallel --semaphore.

Another trick is to nice B:

parallel A ::: a b &
parallel --nice 19 B ::: c d

I usually do that of there are only two competing parallels.


/Ole

Reply via email to