linux process and work

Relations process

Three special process:

  • Zombie process: completion of the task child process has ended the operative part of its code is executed, the system resources are basically back to the system, but the parent process did not make the final finishing work, the process leading to the process control block (PCB) still resides in memory, and the presence of its representatives PCB this process there (because of the presence of PCB is the only sign of progress, there are other news PID), is not dead, this process is called a zombie process (zombie)
  • Orphan process: If the parent process ended (abnormal end), failed to recover the child, the child process is still running, so the child process called orphan process. In the Linux system, the process will generally be orphans "adoption" init process, a child process of init by init do deal with the aftermath.
  • Kernel initialization process: Process 0 is a special process that is created when the system boots, also known as the kernel initialization, its last move was to create a child process to run / sbin / init executable file, the child process is the PID = 1 process 1, and process it into 0-exchange process (also known as the idle process), process 1 (init process) is the first user-mode process, and then it continues to create a system where other processes, so it is all parent or ancestor process user mode process. At the same time it is a daemon that will not stop until the computer shuts down.

Work Management

Reception: Run in the terminal, you have to interact with the process of
the background: run in the terminal, but you do not any of its interactions, can not display its execution of

How to tell a process into the background:
For example:

ls &

Here Insert Picture Description
We can also ctrl + z to make our current front desk stopped and thrown into the background:
For example:

tail -f /var/log/dpkg.log
ctrl+z

Here Insert Picture Description
We can work back through the fg command to get to the foreground,
by the ctrl + z to stop work into the background, we can let it run in the background bg

Common signal value of the work:

Signal value effect
-1 Re-read operation parameters, similar to restart
-2 Operating as ctrl + c Release
-9 Forced to terminate the task
-15 Normal way to terminate the task

Process Viewer tool

top

Here Insert Picture Description
First line: Name of the current program, the system time, how long the system has been started, the current system has several users, system 1 minute, 5 minutes, 15 minutes of load
line of the second: the total number of processes processes, running number of sleeping processes, the number of stops the process, the number of zombie
third line: the current user process using the percentage of cpu, cpu kernel processes using the percentage-priority process changed in the user process space occupied by cpu percentage of idle cpu the percentage of cpu time waiting for input and output percentage, hardware interrupt percentage of occupied cpu, cpu occupancy percentage of soft interrupt, virtual cpu cpu percentage of the actual waiting time
the fourth line: total physical memory, the total amount of free memory, use of physical the total amount of memory, amount of memory used as a cache kernel
fifth row: total amount of swap swap area, the total amount of free exchange zone, the total amount used swap, buffer
content corresponding to the column in the following table:
the PID: process ID
uSER: user belongs to the process
PR: priority (dynamic priority) processes executing
NI: nice value of the process (static Priority)
VIRT: Virtual Memory total number of processes used by the task
RES: process uses the number of physical memory
SHR: process shared memory size
S: state of the process (S = SLEEP, R & lt = running, the Z = Zombie)
% the CPU: Process the cpu utilization
% MEM: process memory utilization
tIME: total time active process
COMMAND: a running process name

ps tool

ps aux

Here Insert Picture Description
USER: the user who owns the process
PID: Process ID
% CPU: process CPU percentage
% MEM: process memory percentage
VSZ: process uses virtual memory size
RSS: the use of physical memory size
TTY: terminal ID
STAT: process status
START: time to start the process
tIME: process consumes CPU time
cOMMAND: command name and parameters

pstree

parameter:

  • -A: In between the program tree to connect ASCII bytes
  • -p: PID also listed for each process
  • -u: also lists the names of all users of each process

Process Control

Find the process:

ps aux | grep nginx

The end of the process:

kill -9 [PID]
Published 21 original articles · won praise 0 · Views 324

Guess you like

Origin blog.csdn.net/u012060395/article/details/104449610