Using multi-thread/multi-process with xargs in a multicore computer

If you have a computer with multiple cores, to fully utilize the computational power, you can use the following command.

xargs -P m ...

You’d better set m as the number of cores. To see how many cores that your computer has, use the following command

cat /proc/cpuinfo | grep processor | wc -l

Strictly speaking, xargs only uses multi-process. To use multi-thread, you need to program by yourself.

Advertisements