Run Your Command Line Tools On Multiple Threads With MParallel

Run Your Command Line Tools On Multiple Threads With MParallel
Facebook may have decided that you shouldn’t see the news, but we think you deserve to be in the know with Lifehacker Australia’s content. To sign up for our daily newsletter covering the latest news, hacks and reviews, head HERE. For a running feed of all our stories, follow us on Twitter HERE. Or you can bookmark the Lifehacker Australia homepage to visit whenever you need a fix.

Command line tools can provide more power and flexibility over a graphical front-end, especially for the likes of ImageMagick and FFmpeg. Unfortunately, while some of these utilities are multi-threaded, core utilisation isn’t the best when running more than one instance. This is where MParallel steps in, allowing you to explicitly parallelise these tasks.

Designed for the Windows command line, feeding MParallel input is very straightforward. You can either string commands together using colons:

MParallel.exe --count=3 ping.exe -n 16 : ping.exe -n 16 : ping.exe -n 16

Or via a text file, containing commands on separate lines:

MParallel.exe --count=3 --input=my_commands.txt

The major difference between using MParallel and just executing separate instances yourself (say, via multiple command windows), is the MParallel will attempt to make the best use of your system’s available cores.

For converting many images or encoding videos, this will almost always be faster. If you just need a single file processed however, you won’t see any gains.

If you’d like to give it a try, compiled binaries are available in 32 and 64-bit versions. Alternative, you can download the source code from GitHub.

MParallel — Parallel Batch Processor [GitHub, via gHacks]