1
00:00:06,639 --> 00:00:10,855
You now that you know what to
look for in top, let's talk about management

2
00:00:10,855 --> 00:00:15,070
options in top. And in order to
manage something, I'm going to run some processes.

3
00:00:15,589 --> 00:00:20,977
Dd well, sudo I'm going to use
sudo dd if is dev 0 of is

4
00:00:20,977 --> 00:00:26,364
dev null and I want to run
it as a background process and I want

5
00:00:26,365 --> 00:00:31,752
to run it a couple of times,
then I'm getting back to top. And as

6
00:00:31,752 --> 00:00:37,140
I'm going to manage processes, I definitely
need to run this with pseudo privileges.

7
00:00:38,659 --> 00:00:42,979
So here we are back in top, and this
time we can see that serious business is going on.

8
00:00:43,600 --> 00:00:45,119
Load average is
currently at 2.53.

9
00:00:47,039 --> 00:00:52,116
And as you can see, there's a
couple of DD processes that is quite

10
00:00:52,116 --> 00:00:57,193
active, and that means that you might
want to do something about it, because

11
00:00:57,193 --> 00:01:02,270
all these active processes don't leave
much space for other processes anymore.

12
00:01:02,929 --> 00:01:09,170
The most common task that you might be interested in
doing from top is to send a signal to your process.

13
00:01:10,290 --> 00:01:13,730
The K command, which is short
for kill, allows you to do that.

14
00:01:14,769 --> 00:01:19,443
That sounds pretty bad, but really signal
is an instruction. The first thing that

15
00:01:19,443 --> 00:01:24,116
you are going to be asked after
pressing K is which pid you want

16
00:01:24,116 --> 00:01:28,790
to kill and it defaults to the
top pid. And that's okay with me.

17
00:01:29,329 --> 00:01:30,209
So I'm
pressing enter.

18
00:01:31,090 --> 00:01:35,840
So next we can see that it's asking
for a signal. Now, what is a signal?

19
00:01:36,340 --> 00:01:40,385
A signal is the instruction from
the operating system, and by default

20
00:01:40,385 --> 00:01:44,430
it's sending sigterm. And sigterm means
process, you need to go away.

21
00:01:45,349 --> 00:01:49,504
The process cannot ignore this request
and that is why it will

22
00:01:49,504 --> 00:01:53,659
be removed from the process table.
That's what we see right here.

23
00:01:54,680 --> 00:01:59,525
So killing is one of the things that you can
do from top. Another thing that you can do from top

24
00:01:59,525 --> 00:02:04,370
is change the process priority. So we can see a
couple of dd processes right now. 3907, 3902 and 3964.

25
00:02:04,409 --> 00:02:07,090
And in the third column we can see
that all of them have a priority of 20.

26
00:02:13,060 --> 00:02:17,250
Now, if you want to
make one process more equal than

27
00:02:17,250 --> 00:02:21,439
the other processes, you can
use R for re. Nice.

28
00:02:22,520 --> 00:02:26,430
So now it's asking for the pid that I
want to renice. So I want to Renice 3907.

29
00:02:28,110 --> 00:02:32,759
Let me press enter and then it's going
to ask the value that we want to use.

30
00:02:33,460 --> 00:02:39,066
Now when you are renicing, you can
Renice from minus 20 to positive 19, where

31
00:02:39,066 --> 00:02:44,671
minus 20 means that you are getting
the highest priority. So it will go before

32
00:02:44,671 --> 00:02:50,277
other processes and positive 19 means that
you are lowering the priority of this process.

33
00:02:50,278 --> 00:02:55,884
Well, I can see that 3907 is
already quite busy as it is, so I

34
00:02:55,884 --> 00:03:01,490
am going to give it positive 10
and then I'm pressing enter to apply that.

35
00:03:02,129 --> 00:03:07,506
You should know that if you
want to use a negative nice value,

36
00:03:07,506 --> 00:03:12,883
you need to be a root
user, so you need administrative privileges, and

37
00:03:12,883 --> 00:03:18,259
ordinary non root users can only
lower the priority of their processes.

38
00:03:19,120 --> 00:03:25,134
So here we go. You can see that 3907
has changed its priority and now it's listed in

39
00:03:25,134 --> 00:03:31,149
the third column with a PR, which is
priority of 30 and a nice value of 10.

40
00:03:31,770 --> 00:03:36,569
And as you can see, it's almost disappearing. And that's
what you can do in top to manage your processes.

41
00:03:37,419 --> 00:03:41,620
Let me use Q to get out of
there, because for now this is enough about top.
