Running commands in parallel with a limit of simultaneous number of commands
- by Vi
Sequential: for i in {1..1000}; do do_something $i; done - too slow
Parallel: for i in {1..1000}; do do_something $i& done - too much load
How to run commands in parallel, but not more than, for example, 20 instances per moment?
Now usually using hack like for i in {1..1000}; do do_something $i& sleep 5; done, but this is not a good solution.