1. Linux top命令输出中PR值和NI值有什么不同
NI 是优先值,是用户层面的概念, PR是进程的实际优先级, 是给内核(kernel)看(用)的。
一般情况下,PR=NI+20, 如果一个进程的优先级PR是20, 那么它的NI(nice)值就是20-20=0。
可以通过改变NI来改变PR: PRI(new) = PRI(old) + nice
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 kern
NI 是优先值,是用户层面的概念, PR是进程的实际优先级, 是给内核(kernel)看(用)的。
一般情况下,PR=NI+20, 如果一个进程的优先级PR是20, 那么它的NI(nice)值就是20-20=0。
可以通过改变NI来改变PR: PRI(new) = PRI(old) + nice
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 kern