Process/thread Model
Stopped: The process stops running after it receives a stop signal
Ready: Running
Executing is waiting in the running queue
Uninterruptible sleep: Non-terminal refers to the CPU does not respond to external hardware interrupts, but the process does not respond to asynchronous signals
Interruptible sleep: Waits for certain events to occur and is suspended
Zombie: The process has been terminated, but the process control blocks (and a few resources) of the processes have not been recycled
Program Priority , the smaller the number, the higher the priority, the more priority to get the opportunity to run, get more CPU run time
0-99: Kernel control
100-139: Users can control
Nice value : Elegant, friendly, smaller, more preferred
Ordinary users can only change the nice value of the large process, cannot be changed to small
process number : 1-65535
Init's process number is always 1, which is the parent process for all processes
Ps:process State
Style:
System v Style: option to use-
BSD style: Option not required-
A: Show all processes associated with the terminal
U: Show more detailed information
x: All processes unrelated to the terminal
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/31/wKiom1XIUhahxhsFAAIKO-aWETs899.jpg "title=" PS "alt = "Wkiom1xiuhahxhsfaaiko-awets899.jpg"/>
-elf: Show more detailed information 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M00/71/2D/wKioL1XIVJOjHDugAAQsxvu_mzg866.jpg " Title= "PS2" alt= "wkiol1xivjojhdugaaqsxvu_mzg866.jpg"/>-o properyt1,property2,... : Specify the attribute fields to display
Ps-o Pid,ni, the foreground only process is displayed by default, Ps-axo Pid,ni Show All Processes
Process status in PS query:
D: Non-terminal sleep
R: Run or ready
S: interruptible Sleep
T: Stop
Z: Zombies
<: high-priority process
N: Low-priority inheritance
+: Processes in the foreground process group
L: Multi-threaded inheritance
S: The first process of the session process
The command field in the PS query is represented by a thread in the kernel.
pgrep: Show process PID under specific conditions
Pgrep [OPTIONS] CONDITION
-L: Simultaneous display of process and PID
-O: When matching multiple processes simultaneously, the one with the smallest process number is displayed
-N: The one that displays the largest number of processes when matching multiple processes simultaneously
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/31/wKiom1XIVgSipAEtAACI7YXWDTo371.jpg "title=" Pgrep " alt= "Wkiom1xivgsipaetaaci7yxwdto371.jpg"/>
pidof: Show PID for a specific process
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/2E/wKioL1XIWs2Ayi2xAABySGqWF0c261.jpg "title=" Pidof " alt= "Wkiol1xiws2ayi2xaabysgqwf0c261.jpg"/>
Top: Real-time monitoring of process information, by default based on the percentage of cups from large to small sort
-D #: Specifies the amount of time to refresh, in seconds
-B: Batch mode, displaying information for all processes
-N #: Number of refreshes in batch mode
Interactive commands for top:
M: Sort based on the size of the resident memory
P: Sort by CPU percent usage
T: Sort by cumulative time
L: Show average load and start time
T: whether to display process and CPU status related information
M: whether memory-related information is displayed
C: Whether to display full command line information
Q: Exit Top
K: Terminate a process
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/32/wKiom1XIWoXQ35jPAAQE_hzjBQs710.jpg "title=" Top " alt= "Wkiom1xiwoxq35jpaaqe_hzjbqs710.jpg"/>
kill: Send a signal to the process
Kill [OPTION] PID
Important signals in Kill:
1:sighup allows a process to reread a configuration file without restarting it and let the new configuration information take effect
2:sigint Ctrl + C interrupts a process
9:sigkill kills a process and forcibly kills
15:sigterm terminates a process, terminates at the correct process, and the default option
Specify a signal:
Signal Number: KILL-1
Signal Name: Kill-sigkill
Signal name shorthand: Kill-kill
Note: Kill can only receive PID and%jobid,killall only the process name
To adjust the nice value :
To adjust the nice value of a process that has already started:
Renice NI PID
Specify a nice value at startup:
Nice-n NI COMMAND
Front desk and backstage
Foreground job: Occupy command prompt
Background job: After startup, release the command prompt, and subsequent operations are completed in the background
Front desk--Backstage:
CTRL + Z: Send the job at the front desk to the backstage
Command &: Let commands execute in the background
Jobs: View all jobs in the background
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/32/wKiom1XIXa3jY8lwAAA8peLSdZs132.jpg "title=" Jobs " alt= "Wkiom1xixa3jy8lwaaa8pelsdzs132.jpg"/>
BG: Let the stop job in the background continue to run
[JOBID]: The default does not add job number to perform a job with +
FG: Back-office jobs to the foreground
[[%]jobid]: The default does not add job number to perform a job with +
Kill%jobid: Terminate a job
vmstat: displaying virtual memory information
# *: Every # seconds refresh, refresh * times
Linux Learning Notes < 16 >--Process Management