I am interested in knowing what are the kernel side methods that get called when you issue the nice and renice commands? I found the set_user_nice() in the kernel side. However it's arguments are not pid and nice value, which we use when we issue the command renice(a taskstruct & nice value). Dose anyone know what functions gets called when you issue nice & renice commands?
Asked
Active
Viewed 1,467 times
1
-
I think renice calls set_user_nice(), because renice is for processes already running. Nice is to start a process with modified nice value.. – user340 Aug 27 '12 at 03:31
-
You realize those programs are open source? Search for GNU coreutils. – Karl Bielefeldt Aug 27 '12 at 04:32
1 Answers
1
The nice
and renice
commands invoke the setpriority
syscall. (You can discover this with strace
.)
The setpriority
function invokes the sys_setpriority
function in the kernel (though you won't find that name in the kernel source directly; it's generated from the macro-expansion of SYSCALL_DEFINE3(setpriority, ...)
).

ephemient
- 198,619
- 38
- 280
- 391
-
1@BasileStarynkevitch Yes there is, but apparently `nice(1)` doesn't use it. – ephemient Aug 27 '12 at 13:57