运维部落

首页 > Linux > Linux top命令输出中PR值和NI值有什么不同

Linux top命令输出中PR值和NI值有什么不同

2015年2月12日

NI 是优先值,是用户层面的概念, PR是进程的实际优先级, 是给内核(kernel)看(用)的。
一般情况下,PR=NI+20, 如果一个进程的优先级PR是20, 那么它的NI(nice)值就是20-20=0。

NI is the nice value, which is a user-space concept. PR is the process’s actual priority, as viewed by the Linux kernel.

For normal processes, the kernel priority is simply +20 from the nice value. Thus a process with the neutral nice value of zero has a kernel priority of 20. This offset-by-20 is done so that a process with a nice value of -20, the highest priority nice value, receives a kernel priority of zero. Lower numeric values equal higher scheduling priority.

For realtime processes, the kernel priority is the process’s real-time priority, but thePR column will simply print RT.

In some versions of the Linux kernel, the kernel priority could differ from the nice value, as the process scheduler applied a small bonus or punishment to interactive or processor-hogging tasks, respectively. In these older kernels, the value given by the PR column could differ from the nice value. This isn’t true with the kernel’s current scheduler, the Completely Fair Scheduler (CFS).

This article come from:

http://www.quora.com/Linux/What-is-the-difference-between-the-NI-and-PR-values-in-the-top-1-commands-output

分类: Linux 标签: ,
本文的评论功能被关闭了.