Given a VM with 1 CPU. I run two similar CPU intensive tasks in two terminals:
/usr/bin/nice -n -20 perl -e 'while(1){$a=1+1;}'
/usr/bin/nice -n 19 perl -e 'while(1){$a=1+1;}'
I would expect that when I check with top, 1 process would take all the CPU and the other none (because there is no idle time left). But...
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
18175 root 1 -20 20376 1460 1132 R 49.9 0.1 0:18.36 perl
18176 root 39 19 20376 1460 1132 R 49.9 0.1 0:15.16 perl
Why is that? I want my process to humbly only use idle CPU cycles :)
Tested on Linux 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux