PDA

View Full Version : Why does the prior level change in this case.



Overworked_PhD
01-29-2008, 09:54 PM
I need to undertand why the following works the way it does.

When I do something like



cat < /dev/zero | grep "f" > /dev/null &


And then exit the bash shell, I see the following on top



PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND
4372 cd 64 0 164M 146M sleep biowai 84:25 8.01&#37; grep
5664 _postfix 2 0 820K 884K sleep select 86:57 0.00% qmgr


Now I do the same thing again. Ie



cat < /dev/zero | grep "f" > /dev/null &


But instead of exiting, I kill the bash session. Which in turn logs me out. When this happens, 2 minutes later, I see



PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND
4372 cd -5 0 164M 146M sleep biowai 84:25 8.01% grep
5664 _postfix 2 0 820K 884K sleep select 86:57 0.00% qmgr


Ie, the PRI changes from 64 to -5 and as a result, the system starts to slow. What would trigger such behavior?

brewbuck
01-30-2008, 04:15 PM
The priority is a dynamic value. You shouldn't expect it to remain the same every time you look at it. It's part of the scheduling algorithm.

matsp
01-30-2008, 04:38 PM
Also, I doubt very much that it would affect the performance of the system - it's only using 8% CPU time.

--
Mats