Frequently Asked Question
How do I change a process's priority with nice and renice?
Every Linux process carries a "nice value" between −20 and +19. The higher (nicer)
the value, the less CPU the scheduler gives the process when something else wants
to run. The default is 0. nice -n 10 ./my-job starts a job at nice 10, a polite
"yield to anything interactive" setting; nice -n 19 ./my-job is the lowest
priority you can pick. To change a process that is already running, use
renice 5 -p 12345, or interactively press F7/F8 in htop.
Only root can decrease a nice value (i.e., raise priority), so ordinary users can
only make their own processes less greedy, never more. Below the nice scale lives a
separate world of real-time scheduling classes (SCHED_FIFO, SCHED_RR) set with
chrt, which run ahead of every normal process and need root by default. For
everyday batch work, a backup, a video transcode, a long compile, nice 10 is
the right reflex.