[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parallelism a la make -j <n> / GNU parallel
From: |
Greg Wooledge |
Subject: |
Re: Parallelism a la make -j <n> / GNU parallel |
Date: |
Fri, 4 May 2012 15:11:41 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, May 04, 2012 at 09:02:27PM +0200, John Kearney wrote:
> set -m
> cnt=0
> trap ': $(( --cnt ))' SIGCHLD
> set -- {0..20}
> while [ $# -gt 0 ]; do
> if [[ ${cnt} -lt 10 ]] ; then
>
> (
> d=$(( RANDOM % 10 ))
> echo $n sleeping $d
> sleep $d
> ) &
> : $(( ++cnt ))
> shift
> fi
> echo going to wait
> sleep 1
> done
You're busy-looping with a 1-second sleep instead of using wait and the
signal handler, which was the whole purpose of the previous example (and
of the set -m that you kept in yours). And $n should probably be $1 there.
Re: Parallelism a la make -j <n> / GNU parallel, Chet Ramey, 2012/05/04
- Re: Parallelism a la make -j <n> / GNU parallel, Mike Frysinger, 2012/05/04
- Re: Parallelism a la make -j <n> / GNU parallel, Andreas Schwab, 2012/05/04
- Re: Parallelism a la make -j <n> / GNU parallel, Mike Frysinger, 2012/05/04
- Re: Parallelism a la make -j <n> / GNU parallel, John Kearney, 2012/05/04
- Re: Parallelism a la make -j <n> / GNU parallel,
Greg Wooledge <=
- Re: Parallelism a la make -j <n> / GNU parallel, John Kearney, 2012/05/04
Re: Parallelism a la make -j <n> / GNU parallel, Mike Frysinger, 2012/05/04
Re: Parallelism a la make -j <n> / GNU parallel, John Kearney, 2012/05/04
Re: Parallelism a la make -j <n> / GNU parallel, Mike Frysinger, 2012/05/05
Re: Parallelism a la make -j <n> / GNU parallel, Andreas Schwab, 2012/05/05
Re: Parallelism a la make -j <n> / GNU parallel, Chet Ramey, 2012/05/07
Re: Parallelism a la make -j <n> / GNU parallel, John Kearney, 2012/05/05
Re: Parallelism a la make -j <n> / GNU parallel, Mike Frysinger, 2012/05/06
Re: Parallelism a la make -j <n> / GNU parallel, John Kearney, 2012/05/06
Re: Parallelism a la make -j <n> / GNU parallel, Chet Ramey, 2012/05/04