Linux one-day footprints: Process Management

Source: Internet
Author: User

Process
Process: Running in-memory program instances, a process is a state of running a program, is an in-memory concept, the process and process can not access the other side of the private memory area.
Threads: the smallest unit that a program runs, a process can derive multiple threads, a thread within the same process can access each other's memory regions, and shared memory regions of the same process can be shared.
Process number: PID
Parent Process Number: Ppid

Pstree command

Pstree command to view the structure of a process

-A

Displays the completion instructions for each program, including the path, parameters, or identity of the resident service.

-C
Do not use the thin label method
-G
Column drawing characters using the VT100 terminal
-H
Lists the tree chart, with special indication of the program being executed
-L
Display tree chart in long column format
-P
Show program Identification code
-U
Show user Name
-U
Using UTF-8 column drawing characters
-V
Display version Information
-N
Sort by Program identification code

[Email protected] ~]# Pstree
INIT─┬─AUDITD───{AUDITD}
├─crond
├─2*[dhclient]
├─master─┬─pickup
│└─qmgr
├─6*[mingetty]
├─RSYSLOGD───3*[{RSYSLOGD}]
├─sshd───sshd───bash───pstree
├─UDEVD───2*[UDEVD]
└─xinetd

Viewing process information at rest
Ps
PS View process information on the current tab page
PS aux system process snapshot
Ps-ef e All Processes F full Format list

Pgrep used to filter the process number

Dynamically View process information

Top Terminal

"D" modifies default refresh frequency, default 3s
"P" is sorted by Cup occupancy percentage
"M" is sorted by memory usage
"H" Displays help information
"<>" page
"K" Kills process Kill

Stop process

The KILL command in Linux is used to stop the running of the specified process (terminate a process) and is a common command for process management under Linux.
Usually stop a foreground process can use CTRL + C key combination, but for a run in the background process need to use the KILL command to terminate, we
You need to use tools such as PS, Pidof, Pstree, and top to get the process PID, and then use the KILL command to kill the process.
The KILL command ends the process by sending a specified signal to the process. By default, a term signal of number 15 is used. Term letter
Will terminate all processes that cannot capture the signal.
For those processes that can capture the signal, a kill signal numbered 9 is used to forcibly "kill" the process.

Command format
Kill [Parameter] [process number]
Command function:

Sends the specified signal to the corresponding process. Not specifying a model will send SIGTERM (15) to terminate the specified process. If you cannot terminate the program, "KILL" is available
parameter, which sends a signal of SIGKILL (9), will force the end of the process, use the PS command or the jobs command to view the process number. Root with
Users will be affected by the process, and non-root users can only affect their own processes.

Parameter description

-L signal, if no signal number parameter, then use "L" parameter will list all the signal name
-A does not restrict the correspondence between the command name and the process number when processing the current process
-p Specifies that the KILL command prints only the process number of the related process without sending any signals
-s specifies the signal to send
-U Specify user

Xkill where to turn off the point, mainly used to stop the graphical (GUI) program

Process priority

NI Nice

Number means:-20-19 The smaller the number, the higher the level.

Ps-le | grep ping <== View ping priority

Specify the priority level

Nice-n 3 Ping ipxxxxx

Adjust the priority level

renice-n [ -20-19] [PID]

----------------------------------------------------

Small white slag typesetting- -650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0066.gif "alt=" J_0066.gif "/>

Linux one-day footprints: Process Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.