(B17) Basic Linux part27 process priority - nice, renice

Опубликовано: 16 Март 2026
на канале: Latif Shaik (latiftechnotes)
23
0

20220504 121445
ps -e
ps -ef
ps -ax
ps -aux

ps -eo user,pid,ni,cmd

ps -eo user,pid,ni,cmd | grep name
--------------------------------
nice -- run a program with modified scheduling priority

Niceness values
range from -20 (most favorable to the process) to 19 (least favorable
to the process).

-20 --highest priority
-10 -high
-5 --normal
0 --normal
5 --normal
10 --low
19 --lowest priority


p1 -- ni 10
p2 -- ni 5
p3 -- ni -5
p4 -- ni -10
p5 -- ni 0
--------------------------------
open a process with nice value

root# nice -n -10 sleep 100 &
[1] 4106

root# ps -eo user,pid,ni,cmd | grep sleep
root 4101 0 sleep 60
root 4106 -10 sleep 100

root@# renice -n 5 4106
4106 (process ID) old priority -10, new priority 5

root# ps -eo user,pid,ni,cmd | grep sleep
root 4106 5 sleep 100
root 4124 0 sleep 60
root 4128 0 grep --color=auto sleep

root# nice -n 10 gedit &
[1] 4189

root# ps -eo user,pid,ni,cmd | grep gedit
root 4189 10 gedit
root 4203 0 grep --color=auto gedit

root# renice -n -15 4189
4189 (process ID) old priority 10, new priority -15

root# ps -eo user,pid,ni,cmd | grep gedit
root 4189 -15 gedit
root 4226 0 grep --color=auto gedit

-----------
nice -- cmd to open a process with priority(nice value)

renice -- cmd to change nice value of process with pid

renice -n nicevalue pid
-----------------