First use top perhaps ps -l Check the process and you will find PR(PRI) NI Two fields :NI Is the priority value , It is a user level concept , PR Is the actual priority of the process ,
It's for the kernel (kernel) see ( use ) of .
Normally ,PR=NI+20, If the priority of a process PR yes 20, So its NI(nice) Value is 20-20=0.
Process scheduling priority is from -20 reach 19, altogether 40 Levels , The larger the number , Indicates that the process has a lower priority . Default time , The priority of the process is 0. There are two ways to view process priorities :ps and top.top Command display NI The value of the column . Or you can use ps
-efl To see , Also in ni The list shows the priority of the process .
The priority of the process can be set when the program is running , It can also be dynamically modified during program operation .
transport The priority of the process can be set when the process is running nice command , For example, to make top The priority of the command when running is 5 Not the default 0, You can use nice -n 5
top, To make top The command runs in 5 Priority of . If top The command is already running , There are two ways to dynamically adjust the level of the process . Can be in top Medium input r command , Then follow the instructions
Display input top Process number corresponding to the command , Then follow the prompts to enter which level to adjust to . Another way is to use renice command , Help is as follows :
[oracle@rac1 ~]$ renice --help
usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]
this The command is also very simple to use , Individual processes can be adjusted , Priority of all processes of a user or group . Examples are as follows :
#renice +10 -u
oracle, This command puts oracle The priority of all processes of the user is set to 10, Including newly created and already running oracle All processes of the user . Here +10 Not a table
It is shown that it can be adjusted upward at the existing level 10 Levels , But adjust to positive 10 Level of , So run this command multiple times , The priority of the process will not change again , Will stay in +10 level .
#renice 10 18625 take PID by 18625 The priority of the process is adjusted to 10
be careful : If not root jurisdiction , The field can only reduce the scheduling priority but not increase it , Even the processes of their own users , After I turned it up , The priority can no longer be adjusted to the original value , Unless used root The user calls it back .
After system restart , The adjustment of process priority is invalid , The scheduling of all processes returns to the default initial level .
Technology
Daily Recommendation