根据top
的联机帮助页:
16. PR -- Priority
The scheduling priority of the task. If you see `rt' in this
field, it means the task is running under real time scheduling priority.
Under linux, real time priority is somewhat misleading since
traditionally the operating itself was not preemptible. And while the 2.6
kernel can be made mostly preemptible, it is not always so.
我尝试更改正在运行的进程以具有实时优先级:
$ sudo chrt -f -p 1 2179
$ chrt -m
SCHED_OTHER min/max priority : 0/0
SCHED_FIFO min/max priority : 1/99
SCHED_RR min/max priority : 1/99
SCHED_BATCH min/max priority : 0/0
SCHED_IDLE min/max priority : 0/0
SCHED_DEADLINE min/max priority : 0/0
$ chrt -p 2179
pid 2179's current scheduling policy: SCHED_FIFO
pid 2179's current scheduling priority: 1
$
但top
显示
Tasks: 255 total, 3 running, 252 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.4 us, 0.3 sy, 0.0 ni, 95.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 19658969+total, 19371019+free, 2405528 used, 473984 buff/cache
KiB Swap: 4194300 total, 4194300 free, 0 used. 19352804+avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2179 myuser -2 0 25552 2892 2648 R 100.0 0.0 67:16.22 my_application
它显示-2 作为优先级。应该是吗rt
?
我确实看到一些像优先migration/0
级rt
一样的流程。