需要在PRI标准格式说明解释PS - 在文档中可能的错误 [英] Need explanation on pri standard format specifier for ps - possible bug in documentation

查看:276
本文介绍了需要在PRI标准格式说明解释PS - 在文档中可能的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意从ps的手册页PRI:

Note on pri from ps man page:

进程的优先级PRI优先级。数字越大,意味着较低的优先级

"pri PRI priority of the process. Higher number means lower priority"

考虑PID 26073 这里

$ renice +15 26073 


26073: old priority 5, new priority 15 # I am making this process more nice 

$ ps -t 1 -o pid,ppid,%cpu,stat,cmd,bsdstart,time,pri

  PID  PPID %CPU  STAT CMD      START     TIME PRI
 9115 18136  0.0   Ss   bash     17:10 00:00:01  19
26073  9115 12.0   RN+  p4 sync  19:06 00:02:56   4

STAT = RN +,这意味着:跑步,低PRIO(宽容待人),前景。 PRI = 4(1)

STAT = RN+ which means : Running , low-prio ( nice to others), foreground. PRI=4 (1)

$ sudo renice -10 26073 

26073: old priority 15, new priority -10 # I am making this process less nice

 $ ps -t 1 -o pid,ppid,%cpu,stat,cmd,bsdstart,time,pri

  PID  PPID %CPU STAT CMD       START     TIME PRI
 9115 18136  0.0  Ss   bash     17:10 00:00:01  19
26073  9115 12.0  S<+  p4 sync  19:06 00:03:15  29

STAT = S 1 +,这意味着:中断睡眠,高PRIO(不好听给别人),前景。 PRI = 29(2)

STAT = S<+ which means : Interruptible sleep , high-prio ( not nice to others), foreground. PRI=29 (2)

在的情况下2进程的优先级提高或者说另一种方式的过程变得更高的优先级。

In case 2 the process priority increased or to say it another way the process became higher priority.

但这个矛盾是什么定义优先级从手册页(即数字越大,意味着较低的优先级)

But this contradicts what definition of pri says from man page ( that higher number means lower priority)

推荐答案

您正在 PRI (当务之急)与 NICE混淆(分配的优先级)。 PRI 往往得到了提升(即较低的值),当一个进程被阻塞在I / O后重新启动,反过来降低(高值),如果使用了它的调度-assigned时隙无阻塞,至少与标准的调度。许多系统具有不同的行为替代调度,但在所有情况下 PRI 是实际的当前优先级,该调度程序已经分配;这个值是由影响,但不被,所分配的优先级。

You are being confused by PRI (immediate priority) vs. NICE (the assigned priority). PRI often gets a boost (i.e. lower value) when a process is being restarted after blocking on I/O, and conversely is lowered (higher value) if it uses up its scheduler-assigned time slot without blocking, at least with the standard scheduler. Many systems have alternative schedulers with different behaviors, but in all cases PRI is the actual current priority that the scheduler has assigned; this value is influenced by, but not defined by, the assigned "niceness".

参考在Linux上的优先级管理这里:<一href=\"http://oreilly.com/catalog/linuxkernel/chapter/ch10.html\">http://oreilly.com/catalog/linuxkernel/chapter/ch10.html

Reference on Linux's priority management here: http://oreilly.com/catalog/linuxkernel/chapter/ch10.html

这篇关于需要在PRI标准格式说明解释PS - 在文档中可能的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆