First, process management
Process is a program or command is running, each entity is a process that runs, has its own address space, and take up some system resources.
Second, the role of process management
1, to determine server health
The top command: The default is updated every three seconds.
top - 16:13:16 up 7 days, 18:08, 1 user, load average: 0.30, 0.41, 0.32
Tasks: 211 total, 2 running, 209 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.0 us, 0.8 sy, 0.0 ni, 97.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 32948204 total, 1006220 free, 11471600 used, 20470384 buff/cache
KiB Swap: 16773116 total, 16773116 free, 0 used. 20841936 avail Mem
---------------------------
16:13:16: current time;
up 7 days, 18:08: system uptime;
1 user: user currently logged two
load average: 0.30, 0.41, 0.32: 1 minute, 5 minutes, before the load average 15 minutes; the machine 1 is a nuclear core is 8 1,8
Tasks: 211 total, 2 running, 209 sleeping, 0 stopped, 0 zombie: the number of statistical processes, and finally a zombie process, the process is shutting down
2, View all processes
(1) ps command: ps aux to see all processes, process description
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 19356 1092 ? Ss 2017 59:03 /sbin/init
root 2 0.0 0.0 0 0 ? S 2017 0:01 [kthreadd]
root 3 0.0 0.0 0 0 ? S 2017 25:33 [migration/0]
user: The process by which user generated
PID: ID number of the process
% CPU% MEM: The percentage of physical memory and CPU process takes, the higher the more resource-intensive
VSZ: process consumes virtual memory size, the unit is KB
RSS: the size of the actual physical memory occupied by the process, the unit is KB
TTY: The process in which the terminal is running. Which, tty1-tty7 behalf of the local terminal console, tty1-ty6 local character interface terminal, tty7 is a graphics terminal. pts / 0-255 behalf of the virtual terminal. ? On behalf of the process is not generated by the terminal, the system kernel is generated
STAT: process status. R: Run; S: Sleep; T: Stop; S: subprocess comprising, +: in the background
START: time process has started.
TIME: The process CPU computation time, not the system time
COMMAND: command name for this process to produce
(2) pstree: Process tree pstree -p (process with pid)
3, kill the process
kill
kill -l pid number: restart the process
kill -9: Forced to kill the process
killall process name: Kill all processes
pkill and killall Similarly, a multi-function terminal kicked: pkill - t terminal number:
First check with the terminal log w, then pkill -9 -t user terminal number kick