Why is parallel –nice not setting the niceness

gnu-parallel

If I run a command with nice, then I can see its process having the expected niceness value:

In one terminal:

nice sleep 17

and in another one:

$ ps -aoni,comm | grep sleep
 10 sleep

But trying to do the same with GNU parallel (version 20161222, Debian 9.3), I fail:

parallel --nice 10 sleep ::: 17

$ ps -aoni,comm | grep sleep
  0 sleep

I am probably missing something obvious, but what ?

update: perhaps it is just a bug, because it worked with older versions…

Best Answer

You have found a bug. Thanks.

It was introduced in parallel-20160522, and until now did not have any automated testing to check that --nice was working locally.

Next release will have both testing and --nice working.

The workaround for local jobs is to run parallel with nice:

nice -n 18 parallel bzip2 '<' ::: /dev/zero /dev/zero

The bug only affects local jobs: Remote jobs are niced as you would expect.

Related Question