The energy associated with Linux demand line are gauged through the proven fact that you can also effortlessly tweak the scheduling concern of procedures command that is using tools. Yes, that’s possible, and in this tutorial we shall talk about how exactly to do this making use of nice and renice resources.

But before we do this, it is well worth mentioning that most examples in this essay have already been tested on an Ubuntu 16.04LTS system.

Linux good and renice commands

Even though the good demand allows you to perform a program/process with modified scheduling concern, the renice demand enables you to replace the scheduling concern of an process that is already running. Following is the generic syntax for both these commands:


renice [-n] priority [[-p] pid …] [[-g] pgrp …] [[-u] user …]

Here’s what their respective man pages have to say about them:

Run COMMAND with an adjusted niceness, which affects process schedul?
ing. The current niceness with no COMMAND, print. Niceness values
range from -20 (many favorable on procedure) to 19 ( favorable( that is least****************)to the process).
Renice alters the scheduling priority of one or more processes that are running
The after whom parameters are interpreted as procedure ID's, procedure
group ID's, or individual names. Renice'ing a procedure team causes all pro?
cesses along the way team to possess their scheduling concern changed.
Renice'ing a person causes all procedures owned by an individual to possess their( priority that is****************)scheduling. By default, the processes to be affected
are specified by their process ID's.

Following are some examples that are q&A-styled provides you with an improved concept how these tools work.

Q1. How exactly to always check niceness of operating programs/processes?

Yeah, you need to first learn how to check out the scheduling that is existing before changing it. Then you should know the default scheduling priority is always 0.

For example, we executed the following process:

./test-new( if it’s about the process you’re about to run,***********)

And confirmed the concern utilising the command that is following***********)

ps -lu himanshu | grep test-new

Here, ‘himanshu’ is the user who owns the ‘test-new’ process. Following is the output the command that is above:

0 S  1000  6306  6125  0  80   0 -   508 hrtime pts/18   00:00:00 test-new

The value in 8th line may be the good value, so that as you can view, it is zero.

Q2. Just how command that is nice?

So now coming to the point, how the nice command works? It’s easy – just use the tool in the following way:


For example, I can do that:

nice -10 ./test-new( if I want the scheduling priority to be 10, here’s how***********)

Following may be the ps demand production in cases like this, confirming the concern happens to be changed to 10.

0 S  1000  6694  6125  0  90  10 -   508 hrtime pts/18   00:00:00 test-new

Q3. Making work that is nice negative values?

As already mentioned in the beginning, niceness values range from -20 to 19, with the former being most favorable, while latter being least. In case you want to associate a negative value that is nice the method, you then’ll need to use dual hyphen.

For instance, 

sudo good –10 ./test-new

Please keep in mind that you must have root privileges to associate an adverse value that is nice a process. And precisely for this reason, your ps command to confirm the niceness that is new include ‘root’ as opposed to the other individual title.

$ ps -lu root | grep test-new

here is the production this demand manufactured in our instance:

4 S 0 7054 7053 0 70 -10 - 508 - pts/18 00:00:00 test-new

So you can view the method has become operating with a great value of -10.

Q4. just how to include a group integer value to niceness?

You can adjust the value that is nice the -n command line option, which adds a set integer value to the niceness. By default, this set value is 10, although you can pass a value that is different well.

-n, --adjustment=N

For instance:

nice –adjustment=5 ./test-new

And here is the production, the ps demand manufactured in this instance:

0 S 1000 7314 6125 0 85 5 - 508 hrtime pts***************************************************) that are/(********************************************************):00:00 test-new

So you can see a priority of 5 was set.

Q5. How to change priority of running processes?

While the nice command is used while launching programs, the renice command lets you change the priority of a process that is running. Including, here is exactly how we changed the concern associated with already-running ‘test-new’ procedure from 5 to 15.

renice -n 15 -p 7314

The -p argument is for procedure ID. After may be the production the command that is above:

7314 (process ID) old priority 5, new priority 15

And the nice value indeed got changed to 15.

Q6. How to change priority for all processes belonging to a combined group?

You may use the -g selection for this. Including:

renice -n 20 -g howtoforge

The above demand changes the concern of all of the procedures of the team ‘howtoforge’.

Q7. How exactly to alter concern for several procedures owned by a person?

To replace the concern for several scheduled programs associated to a user, use the -u option. A normal Linux command line user won’t usually get in situations where-in these tool are needed, but it’s always good to have knowledge of important command line tools, and nice and renice are among them for example:

renice -n 5 -u himanshu

Of course. The thing that is good that the educational bend connected with them is not high anyway. We now have currently talked about most choices right here. To find out more on these resources, visit their guy pages – right here and right here. 

Report: Apple is making unique noise-cancelling that is high-end

Previous article

How exactly to make use of Date and amount of time in JavaScript making use of Date things

Next article

You may also like


Leave a Reply

More in Linux