nice and priority (PRI in top)

I have a game server process on my FreeBSD 7.0 server that needs to be the top priority process - nothing should get in its way. So I used renice as root to set the nice value for the game server process to -20. Now I have a few questions:

1.

Is this safe? Let's say the process with nice value -20 becomes rogue and starts taking up all of the CPU (for example a tight infinite loop in the code). Will I still be able to log in to the machine and kill the process?

2.

I'm looking at the output of top. I see that the PRI column in top for the game server process is 76. A lot of other running processes have priorities in the 96 range. Does PRI mean the lower, the more important? I have some httpd processes with PRI 4 and a rtorrent process with PRI 4, and sshd process with PRI 4. Why are these priorities so low? The rtorrent and httpd processes with PRI 4? What does PRI mean? I looked at the man page for top but that didn't really explain it very well.
 
nice/renice interfere with the system's priority scheduling (PRI), but they do not overrule it completely, so it's very possible that certain processes have a higher priority (based on nice value, cpu use, duration and some other factors), than processes you've reniced. In other words, a renice -20 does not mean every other process has to take a back seat to the process you're giving absolute priority. Therefor, it's quite unlikely that a rogue reniced process will lock you out of your system entirely -- slowdown may occur, of course.

See also man nice and man rtprio.

Oh, and yes: a lower PRI number is a higher scheduling priority.
 
Back
Top