Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've read about nice renice and ionice to control the scheduling priority of running processes. However, I still don't understand when and how are they useful for. For instance doing something like:

nice -n 13 pico myfile.txt
share|improve this question
Thanks for the help!, now it is much clearer. – Jeffrey Darrow Dec 13 '10 at 0:57
up vote 4 down vote accepted

With regards to pico it's unlikely to ever be much cause for concern so it's not the kind of command you would normally nice/renice or ionice. However your command would execute pico niced to +13. Which would mean it would get significantly less time allocated to it. For example, following on from your pico line. Normally pico executed looks like this:

UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S     ADDR TTY           TIME CMD
501 20118 20117     4006   0  31  0  2435548   1068 -      S     eb577e0 ttys000    0:00.03 -bash
501 20136 20118     4006   0  31  0  2434992    772 -      S+    85eed20 ttys000    0:00.00 pico

Where NI is the nice level. If I run pico with your command it looks like this:

UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S     ADDR TTY           TIME CMD
501 20118 20117     4006   0  31  0  2435548   1068 -      S     eb577e0 ttys000    0:00.03 -bash
501 20179 20118     4006   0  18 13  2434992    904 -      SN+   85eed20 ttys000    0:00.01 pico

OK so that demonstrates the command line you run is effective, but what does it actually do? OK let's say you have a system that is quite busy but not obscenely so. It's pretty busy all around the clock, at midnight an essential maintenance task starts. It's mysql command line running a script to generate some daily stats. There's a lot of processing so it hits the CPU hard and the users complain about this. Vehemently, as they do. What can you do about it? It's not essential how long this script takes so you prepend 'nice -n 13' to the command and the next time it runs it doesn't affect the users so bad but takes a bit longer to complete. The owner of the MySQL script doesn't care as he only wants the stats when he gets in the next day. Everyone is happy.

Stories aside these tools can let you exert some control over how the system prioritises the CPU (possibly IO in the case of ionice) time allocated to tasks. They will only have an effect when the system is loaded, before that everyone tasks are being allocated all the time they need.

The renice command works in a very similar way but it allows you to alter the priority of processes that are already running. So in the above anecdote you could use renice to alter the priority of the mysql command without restarting it. The following command would renice all running tasks named 'mysql' to +13, a much lower priority:

renice -n 13 -p `pidof mysql`

As for ionice I cannot comment but would guess it lets you do similar things with IO. Influencing how much io certain tasks get to perform, e.g. disk read/writes. Could be useful in throttling backup process if necessary?

share|improve this answer

ionice is an interface to the IO scheduler subsystem of the Linux kernel, it allows for setting IO priorities on a per process basis. The use-case of that would be something like reducing the priority of the updatedb command that builds the database for the locate command in a way that other IO is running undisturbed as updatedb only gets to do IO when no other IOs are currently running.

share|improve this answer
Thanks for the great info! – Jeffrey Darrow Dec 13 '10 at 0:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.