When
talking about processes priority is all about managing processor
time. In
Linux user can set guidelines for the CPU to follow when it is
looking at all the tasks it has to do. These guidelines are called
niceness
or nice
value.
The Linux niceness scale goes from -20 to 19. The lower the number
the more priority that task gets. If the niceness value is high
number like 19 the task will be set to the lowest priority and the
CPU will process it whenever it gets a chance. The default nice value
is zero.
#top To view the current process.
root@debian:/home/varun#
top
top
- 15:11:07 up 5:15, 2 users, load average: 0.16, 0.12, 0.12
Tasks: 143 total, 1 running, 142 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.0 us, 0.3 sy, 0.0 ni, 97.7 id, 0.0 wa, 0.0 hi,
0.0 si, 0.0 st KiB Mem: 6192552 total, 2297608 used, 3894944
free, 136868 buffers KiB Swap: 11814908 total, 0 used, 11814908
free, 1690312 cached
PID
USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7751
root 20 0 150m 13m 10m S 2.3 0.2 0:00.42
gnome-terminal
5191
root 20 0 72264 18m 5680 S 1.3 0.3 5:01.30 Xorg
5424
varun 20 0 517m 97m 37m S 1.3 1.6 2:20.62 gnome-shell
1
root 20 0 2280 732 628 S 0.0 0.0 0:00.91 init
2
root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3
root 20 0 0 0 0 S 0.0 0.0 0:00.53
ksoftirqd/0
6
root rt 0 0 0 0 S 0.0 0.0 0:00.02
migration/0
7
root rt 0 0 0 0 S 0.0 0.0 0:00.02 watchdog/0
8
root rt 0 0 0 0 S 0.0 0.0 0:00.00
migration/1
10
root 20 0 0 0 0 S 0.0 0.0 0:00.54
ksoftirqd/1
12
root rt 0 0 0 0 S 0.0 0.0 0:00.02 watchdog/1
13
root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset
|
If in above data user can see a Zombie, if that bit is 1 or above it may be a virus or attack.
#ps -el | grep 'Z' To see that bit.
#ps as | grep {process name} To know Process ID, on which terminal it currently working and all details.
#kill {process ID} To
kill the process.
Some process has child process, so if user kill the process the parent process will regenerate the process. To avoid it see the full process tree by, #pstree. Then kill the root process by #kill -9 {process ID}.
Process ID will change in time to time, so before kill must check the process ID once again.
Some process has child process, so if user kill the process the parent process will regenerate the process. To avoid it see the full process tree by, #pstree. Then kill the root process by #kill -9 {process ID}.
Process ID will change in time to time, so before kill must check the process ID once again.
Change priority of process.
When
the process is not running,
#nice
{priority number} {process name}
When user need to change a running process must change using Process Id, first find the process ID then,
#renice
{priority number} {process ID}
No comments:
Post a Comment