Linux nice command: Run Process With Modified Scheduling Priority ( nicenesses )
Q. How do I run a process with modified scheduling priority under Linux? I'd like to change the priority in the kernel's scheduler while starting a command.
A. Use nice command to run a program with modified scheduling priority / nicenesses. Nicenesses range at least from -20 (resulting in the most favorable scheduling) through 19 (the least favorable). The default behavior is to increase the niceness by 10.
A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore.
nice syntax (/bin/nice command)
/bin/nice -n NUM
Add integer NUM (-20 to 19) to the niceness.
WARNING! There are multiple versions of the nice command. One built in to the shell, and one in /bin/nice. The syntax may be diffrent on your system. Refer your shell and /bin/nice command man page for details.Change niceness by 3
Type the command as follows:
$ /bin/nice -n 3 command-name
Only a privileged user may run a process with lower niceness:
$ /bin/nice -n -1 command-name
Shell in build nice command syntax
If you use the csh or tcsh or bash, the syntax is as follows:
nice +n command
I recommend using /bin/nice syntax to avoid confusion and to save time.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Linux / UNIX FAQ:
- renice command: Change the Priority of a Already Running Process
- chrt command: Set / Manipulate Real Time Attributes of a Linux Process
- Linux / UNIX: Find out or determine if process pid is running
- Linux find out what process are eating all memory and time allocated to process
- Kill process in Linux or terminate a process in UNIX or Linux systems
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!
Tags: /bin/nice, kernel, Linux, nice_command, priority, privileged user, process scheduling, scheduler, threads ~ Last updated on: February 26, 2008



Recent Comments
Today ~ 2 Comments
Today ~ 37 Comments
Today ~ 46 Comments
Yesterday ~ 2 Comments
Yesterday ~ 9 Comments