enter image description here

htop is showing that the "sort" command only uses 1 CPU CORE (on an RPM based Linux distro). How can I tell it to use all the available CPU CORES?

  • Are you sure that sorts multi-threadable? – slm Oct 18 '14 at 19:34
  • @slm yes, it is – drevicko May 5 '15 at 10:35

You can use --parallel:

--parallel=N change the number of sorts run concurrently to N

  • This was introduced in coreutils 8.6, with a lot of bugfixes in version 8.8. Older distros (e.g. RHEL6) don't have this. – pdw Oct 18 '14 at 17:32
  • 1
    @pdw I presume OP has a recent version "It's 2015, not the 90'!" – Braiam Oct 18 '14 at 17:34
  • RHEL isn't from the 90's.. 8-) – slm Oct 18 '14 at 17:44
  • @slm he only said RPM based distro, not RHEL ;) – Braiam Oct 18 '14 at 17:45
  • coreutils 8.8 was released Christmas 2010, so that's closer to 2015 than the 90' :) – pdw Oct 18 '14 at 18:23

If you know the PID of the process, you could set the number of CPU cores as discussed here.

  • If you do not have taskset, you could install it as,

    sudo yum install util-linux 
  • For example, to assign a process to CPU core 0 and 4, do the following.

    taskset -cp 0,4 9030 

    With "-c" option, you can specify a list of numeric CPU core IDs separated by commas, or even include ranges (e.g., 0,2,5,6-10).

You could also launch the program mentioning specific CPU cores. So all these details are present in the above referenced link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.