Process Management 1. Process Management
 
 
Process Management:1.1 view Processes
 
1.2 Process Management
 
1. process description ◆ a process is a program or command being executed. Every process is a running entity and has its own address space and occupies certain system resources.
 
 
 
2. Role of process management ◆ determine the server health status
 
◆ View all processes in the system
 
◆ Killing Processes
 
3. View All PROCESSES IN THE SYSTEM
 
[Root @ localhost ~] # Ps aux
 
# View all processes in the system and use the BSD operating system format
 
[Root @ localhost ~] # Ps-le
 
# View all processes in the system and use the standard Linux Command Format
 
[Xiaofeng @ localhost ~] $ Ps aux
 
User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
 
Root 1 3.4 0.6 128092 6692? Ss/usr/lib/syste
 
Root 2 0.0 0.0 0 0? S [kthreadd]
 
Root 3 0.0 0.0 0 0? S [ksoftirqd/0]
 
Root 4 0.0 0.0 0 0? S [kworker/]
 
Root 5 0.0 0.0 0 0? S <[kworker/0: 0 H]
 
Root 6 0.0 0.0 0 0? S [kworker/u256:
 
USER: the USER who generates the process;
 
PID: ID of the process
 
% CPU: the percentage of cpu resources occupied by the process. The higher the CPU usage, the more resources the process consumes;
 
% MEM: Percentage of physical memory occupied by the process. The higher the memory occupied, the more resources the process consumes;
 
VSZ: the virtual memory occupied by the process, in KB;
 
RSS: the actual physical memory occupied by the process, in KB;
 
TTY: the terminal on which the process runs. The tty1-tty7 represents the local console terminal, the tty1-tty6 is the local character terminal, tty is the graphics terminal. Pts/0-255 represents a virtual terminal.
 
STAT: Process status. Common statuses include: R: Run, S: Sleep, T: Stop, s: contains sub-processes, and +: Located in the background
 
START: the START time of the process.
 
TIME: the computing TIME that the process occupies the cpu. Note that it is not the system TIME.
 
COMMAND: name of the COMMAND that generates this process
 
 
 
 
 
4. view the System Health Status
 
[Root @ localhost ~] # Top [Options]
 
Option:
 
-D seconds: specifies the number of seconds that the top command updates. By default, commands that can be executed in the top command interaction mode in 3 seconds are as follows:
 
? Or h: displays the help of the interactive mode.
 
P: sort by cpu usage. This option is used by default.
 
M: sort by memory usage
 
N: sort by PID
 
Q: Exit top.
 
[Xiaofeng @ localhost ~] $ Top
 
Top-15:47:59 up 41 min, 2 users, load average: 0.00, 0.01, 0.05
 
Task: 114 total, 1 running, 113 sleeping, 0 stopped, 0 zombie
 
% Cpu (s): 0.3 us, 0.0 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
 
KiB Mem: 999964 total, 594100 free, 154968 used, 250896 buff/cache
 
KiB Swap: 524284 total, 524284 free, 0 used. 657584 avail Mem
 
Pid user pr ni virt res shr s % CPU % mem time + COMMAND
 
541 root 20 0 302772 6276 S 4820 0.7. 33 vmtoolsd
 
720 root 20 0 178808 4468 S 3596 0.3. 62 vmtoolsd
 
2942 xiaofeng 20 0 157676 2140 R 1508 0.3 0: 00. 18 top
 
1 root 20 0 128092 6696 S 3948 0.0. 97 systemd
 
2 root 20 0 0 0 S 0.0 0.0. 00 kthreadd
 
3 root 20 0 0 0 S 0.0 0.0. 01 ksoftirqd +
 
This is the first line of information, which is the task queue information.
 
 
 
Top-12:26:46 up 1 day, 2 users, load average: 0.00, 0.01, 0.05
 
 
  
   
   Content  |  
   Description  |  
  
 
   
   12:26:46  |  
   Current System Time  |  
  
 
   
   Up 1 day, 13: 32  |  
   System running time. The local machine has been running for 1 day, 13 hours, 32 minutes.  |  
  
 
   
   2 users  |  
   Currently, two users are logged on.  |  
  
 
   
   Load average: 0.00, 0.01, 0.05  |  
   The average load of the system in the previous 1 minute, 5 minutes, and 15 minutes. Generally, when the value is less than 1, the load is small. If the value is greater than 1, the system has exceeded the load.  |  
  
 
  
 
 
 
Second-Action Process Information
 
Task: 114 total, 1 running, 113 sleeping, 0 stopped, 0 zombie
 
 
 
 
  
   
   Content  |  
   Description  |  
  
 
   
   Tasks: 114 total  |  
   Total number of processes in the system  |  
  
 
   
   1 running  |  
   Number of Running Processes  |  
  
 
   
   113 sleeping  |  
   Sleep Process  |  
  
 
   
   0 stopped  |  
   Stopping Process  |  
  
 
   
   0 zombie  |  
   Botnets. If it is not 0, manually check the zombie Process  |  
  
 
  
 
 
 
 
 
Third behavior cpu Information
 
% Cpu (s): 0.3 us, 0.0 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
 
 
  
   
   Content  |  
   Description  |  
  
 
   
   % Cpu (s): 0.3 us  |  
   Cpu usage in user mode  |  
  
 
   
   0.0 sy  |  
   Cpu usage in System Mode  |  
  
 
   
   0.0 ni  |  
   Cpu usage of user processes that have changed their priorities  |  
  
 
   
   99.7 id  |  
   Percentage of idle cpu  |  
  
 
   
   0.0 wa  |  
   Cpu usage percentage of processes waiting for Input/Output  |  
  
 
   
   0.0 hi  |  
   Percentage of cpu occupied by the hard interrupt request service  |  
  
 
   
   0.0 si  |  
   Percentage of cpu used by the soft interrupt request service  |  
  
 
   
   0.0 st  |  
   St (Steal time) virtual time percentage. That is, the percentage of time the virtual cpu waits for the actual cpu when there is a virtual machine  |  
  
 
  
 
 
 
Fourth behavior physical memory information
 
KiB Mem: 999964 total, 594100 free, 154968 used, 250896 buff/cache
 
 
  
   
   Content  |  
   Description  |  
  
 
   
   Mem: 999964 total  |  
   Total physical memory, in KB  |  
  
 
   
   594100 free  |  
   The number of idle physical memory. We use virtual machines. In total, only MB of memory is allocated, so we have MB of idle memory.  |  
  
 
   
   154968 used  |  
   Number of physical memory used  |  
  
 
   
   250896 buff/cache  |  
   Buffer memory size  |  
  
 
  
 
 
 
Fifth behavior swap partition (swap) Information
 
KiB Swap: 524284 total, 524284 free, 0 used. 657584 avail Mem
 
 
  
   
   Content  |  
   Description  |  
  
 
   
   Swap: 524284 total  |  
   Total size of swap partition (Virtual Memory)  |  
  
 
   
   524284 free  |  
   Size of idle swap Partition  |  
  
 
   
   0 used  |  
   Swap partition size used  |  
  
 
   
   657584 avail  |  
   Size of available swap partitions  |  
  
 
  
 
 
 
TopThe command itself is a good system resource. Don't open it all the time, so pay special attention to this!
 
 
 
5. view the process tree
 
[Root @ localhost ~] # Pstree [Option]
 
Option:
 
-P: displays the pid of the process.
 
-U: displays the user of the process.