All right, so in Section 123.6, we're going to look at modifying
We're nearly done with module one of three. Just a few more sections to go
anyway. So when a process runs, it gets a default. Nice value. The nice value is a way to specify the relative priority of a given process compared to everything else.
So we can change this.
We could inspect the value. We can also change it,
and we saw that already
with the top command.
We'll review that here again.
But Top lets me very easily looking a process list and just hit our for re nice
to change the nice value.
examine the current nice value setting of a process by running PS dash yell. There's other ways to see it as well,
and I could see what my current value is
when I just run nice by itself. No,
Now, if I'm launching a process from scratch and I know for sure that I want to give it a certain priority, I can do it on the command. Unlike we see here,
Nice dash end tells me
which gives me the option to specify a priority.
And then I just specify the command.
Negative values give a highest priority. So, uh, Dash 20 negative 20 is the lowest number we can specify here. Which
inversely means that it has the highest priority on that system.
19 would be the lowest priority.
So if I'm sorry about that, if I'm using a Valium 19 that means this process is not very important. Take the least amount of resource is to continue to operate.
see what this looks like.
Very easy to use these commands.
It's clear my screen.
Okay? I don't have any process. He's running right now. I don't have any jobs running right now,
so I'm gonna specify
a job of, uh,
another sleep job.
Now, I will run PS, dash E l
and great for sleep.
And we can see that 40359 actually might have been
I should have just grabbed for the, uh,
process I d. Number
in the eighth column is my nice value. So this
sleep process has a high priority right now.
And I could I could run a, uh,
another sleep process with a plus 10 priority, which read as much lower
and I can grab for that process. I d number 403
And there's it's nice value.
So I can see it right from the command line or we run it from top
freak apologised. You sleep because I don't remember what the p I. D was.
But there's my nice values being shown here.
I can hit the r key, and that happens to be at the top of the list.
So go from negative 10 to negative 20 which is the highest possible priority.
Ah, negative. 20.
Now that one showed up. There it is that one shows up with the highest priority.
So pretty useful.
Now, what do I do if I've got a process that is running at a certain priority and I decided that I want to change it, I can use the re nice command,
so I just given a value
and I could do this at the user in the group level as well, which is kind of nice,
because sometimes that may be more appropriate.
40359 should still be that running process for for sleep.
Oops. I won. I won a ps dash Yell for this. Sorry.
And there's my negative 20. Nice value.
So I can use re nice.
I say that I want
I want to make this a plus 10. Nice value because it's going from very high priority to very low priority.
Old priority minus 20. New priority 10.
So this is very easy to use.
If I type nice by itself, I get my default value, which is currently 20. You can configure that if if you want to change it,
I could also, um,
you have been
Here we go.
So these are all my admin processes and I can see in that eighth column
that I'm Here's one
Ah, pulse Audio. This has a
a p i D of 2024
dash, and I'll give it a priority of
So very simple to do this.
So get familiar with these commands. They are occasionally very useful when you wanted
juggle things around and allocate more resource is for certain things that are taking too long or that you want to finish sooner
and also be able to take other processes and put them in the background because their completion time is not is critical.
All right, that gets us to the end of this section or next topic is searching files with regular expressions.
See you there. Thank you.