"nice" is an historic utility which was used in the early days of batch
computing to be "nice" to other users and give up some CPU time. It's
still in use and useful and applies only to processes which run with
the SCHED_OTHER policy on Linux.
"chrt" is a tool to change scheduling policy (SCHED_OTHER, SCHED_FIFO, SCHED_RR)
and the priority of a process/task. With chrt you can either start a
process with such a policy or modify an already running process/tasks
policy. You need to have the permissions to do that.
So the main difference is that "nice" can only operate within the nice
levels of the SCHED_OTHER policy while "chrt" can change the policy
and the priority of a process/task.
renice does not have an effect detectible by humans but chrt does.
I remember that renice +19 had an effect on SUNOS -- but SUN "fixed" this, probably because people complained about it having an effect.
Decades ago I was complaining about such a feature not being available on any UNIXs (but on Windows) and the notion was rejected by various UNIX gurus -- UNIX being perfect as it was already.
The main application area of chrt is to start processes with idle scheduling class. This is supposed to allow one to start CPU-intensive non-interactive processes without much effecting processes running with other (normal) scheduling classes -- means a parallel build should not cause the video player to stutter.
Well, I found this on http://www.spinics.net/lists/linux-rt-users/msg03987.html which explains the difference pretty nicely:
chrt(1) is used not only to change the priority of a process, but also the scheduling policy. The scheduling policy can be four:
See setscheduler(2).
renice(8) just change the priority of a process.
In few words:
renice does not have an effect detectible by humans but chrt does.
I remember that renice +19 had an effect on SUNOS -- but SUN "fixed" this, probably because people complained about it having an effect.
Decades ago I was complaining about such a feature not being available on any UNIXs (but on Windows) and the notion was rejected by various UNIX gurus -- UNIX being perfect as it was already.
The main application area of chrt is to start processes with idle scheduling class. This is supposed to allow one to start CPU-intensive non-interactive processes without much effecting processes running with other (normal) scheduling classes -- means a parallel build should not cause the video player to stutter.