Processes, running programs, running in their own linear address space
Program: Instruction plus data composition
On a 32-bit host, the 1G kernel is used and the rest belongs to the application
The 32-bit host CPU can handle 32-bit data at the same time, that is, 2 of the 32 power address space, equivalent to 4g address space, so the 32-bit host can support up to 4g of memory.
BSD-style commands do not need to be added-, such as PS
SysV style needs to add-
Fork () system call
Any process that wants to create its own subprocess needs to initiate a fork call that can create the same child as herself and address space
Cow mechanism: Copy on writting
The parent and child processes share the same address space, and when the value of either party needs to be changed, it is assumed that the child process is ripe and the parent process creates its own independent address space
Process hangs: The resulting results are stored in the task struck each time you have not finished processing.
Process priority: 0-139
1-99: Dynamic Priority: The larger the number, the higher the priority level
100-139: Static priority, the smaller the number, the higher the priority
Process classification:
CPU Bound:cpu Intensive
I/O bound: Intensive
Status of the process
R Operating state: Running
Sleep state: Sleeping
S can interrupt sleep: interruptible
D Non-disruptive sleep: uninterruptible
Ready state: Runnable
T stop state: Stopped, cannot be scheduled to run
Z Zombie State: Zombie, the parent process is dead and it's not released yet.
S:session leader
+: Foreground process, occupy a terminal
L: Multithreaded Process
<: high-priority processes
N: Low-priority process
Linux is Lwp:light WEight Process
For Linux, a process is a thread, and a thread is a process.
Process view and management tools: TOP,PSTREE,PS,PIDOF,PGREP,PKILL,HTOP,GLANCES,PMAP,DSTAT,IOSTAT,SAR,KILL,JOB,BG,FG
Pstree:-p can display the process ID
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajtz0snwaak-5pctdre985.jpg "" 636 "height=" 462 "/>
Ps:process Stat
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/96/ Wkiom1ybajsxctj3aagfhpks73c196.jpg "" 640 "height="/>
User: Owner,
PID: Process ID
%CPU:% of CPU
%MEM:% of memory
VSZ: Virtual Memory Set: The amount of space occupied by the linear address space
RSS: Resident Memory Set: The size of the data that cannot be swapped to swap space
TTY: Terminal
STAT: The status of the process, which says
Start: Startup time
Time: Cumulative length
Command: Which commands are started, [] indicates kernel threads
Common formats:
Aux:a related to terminal, x independent of terminal, u user-centric
-ef:e: Show all information, F rich format information
-efh:f Show additional information, h Show hierarchical relationships, view parent-child process relationships
AXO: Customizing the information that needs to be displayed, O: Custom Fields
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/96/ Wkiom1ybajtcgrknaaelm4tp6gm984.jpg "" 617 "height=" 275 "/>
Pgrep: Used to filter processes
-U: Show only processes running as specified user
-L: Show process name
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajwwuyaxaafbdzfitfa967.jpg "" 587 "height=" 235 "/>
PIDOF: Shows the process number occupied by a program
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/96/ Wkiom1ybajwcnx0zaab1pfo3j2k715.jpg "" 593 "height=" "/>
Top: Dynamic display of the first row and uptime,
Parameters
-b:batch: Batch-time display
-N: Specify the display several times
-D: Delay time interval
Action commands
P is sorted by CPU percentage
M Press Memory,
T per CPU cumulative elapsed time
L: Whether the load line is displayed,
T show summary and CPU load
m Displays memory information
Q: Exit
S: Change time delay, default is 3s
K: Terminates the specified process
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/96/ Wkiom1ybajwzov5vaaeeomcncpe629.jpg "" 596 "height=" 103 "/>
1, Top: Current system time: Run often: The current number of users logged into the system: Load status (last 1 minutes, 5 minutes, 15 minutes of load, CPU waiting queue Length)
2. Tasks: Number of processes:
3, CPUs, press 1 key to display the status of each CPU:
Run space CPU scale userspace, kernel code CPU scale System,nice value percentage, idle percentage idel, wait for IO to complete% wait, hardware interrupt processing percent hardwareinterface, Software interrupt processing percent softwareinterface, the time the virtualization was stolen stolen
4, Swap: Virtual memory all space, used space, free space
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajachl9eaafggnmtkpe114.jpg "" 613 "height="/>
PR: Priority
Ni:nice value
VIRT: Virtual Memory Set
RES: Resident Memory Set
SHR: Shared Memory space
S: Status
%cpu: Percentage of CPU occupied
%MEM: Percentage of memory occupied
Time: Cumulative run times
Command: Start commands
Htop
Need to configure Yum source
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/96/ Wkiom1ybajajc2v8aacwqwbclto208.jpg "" 599 "height=" 167 "/>
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/93/ Wkiol1ybajecovhmaajd-smhnuq028.jpg "" 607 "height=" 288 "/>
Usage
U show only the process of the specified user
s trace the system call initiated by the process, ESC exits
L Show documents opened by the process
T: Hierarchical results display
A sets the inherited CPU affinity
Parameters:
-D #: Delay
-u:user
-S: Sort by field
Vmstat:
Delay count
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/93/ Wkiol1ybajebvy9uaafnmtrtrrc481.jpg "" 616 "height=" 134 "/>
R Run Queue Length
B Block Queue Length
Si: rate of data entering swap Kbps
So data out of swap rate Kbps
BI block device read rate Kbps
The rate at which Bo is saved to the block device Kbps
In interrupt rate Kbps
CS Process Switching rate Kbps
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/93/ Wkiol1ybajig7edaaaf52sjtpfy555.jpg "" 445 "height=" 313 "/>
/proc/#接口
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/93/wKioL1YBajiT_ 2bvaacrtuv7-wc018.jpg "616" height= "/>"
Pmap 1
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/96/ Wkiom1ybajib40cyaaiw64kjzjq017.jpg "" 624 "height=" 260 "/>
Glances Support CS Architecture
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajjzhqdnaadgmek6ev0202.jpg "" 631 "height=" 145 "/>
Dstat powerful 650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/96/wKiom1YBajnBXT4uAAGrnA_ 55sm044.jpg "" 636 "height=" 199 "/>
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/96/ Wkiom1ybajmsr9jfaaedtt9741o252.jpg "" 509 "height=" 267 "/>
Common usage
--TOP-CPU, showing the most CPU-based information
--top-bio, showing the process of the minimum number Blockio
--top-io
--top-mem
--IPC displaying data related to interprocess communication
--raw displaying data about raw packages
--tcp displaying data related to TCP sockets
--UDP displaying data related to UDP sockets
--unix
--socket
Inter-process communication:
Signal: Short message, can man 7 signal or kill-l view
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajqcwnupaaid621yclw121.jpg "" 535 "height=" 203 "/>
1 is rereading the configuration file
The signal can be written like this:
1, full write SIGINT
2, abbreviated INT
3. Label 15
Signal to process:
Kill signal Process Number
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/96/ Wkiom1ybajqac8z0aacvnz5vgk4431.jpg "" 508 "height=" 126 "/>
Killall httpd program name to close a set of
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/93/ Wkiol1ybajqshyxaaadz0iq3f6o709.jpg "" 537 "height=" 171 "/>
I'm going to have to add a D, or I can't.
Job Management
Front Desk: Terminal launch
Background: The job starts with terminal-independent, or hangs to the background after the foreground starts regardless of terminal
When started: Ctrl Z sent to background
When not started: You can command & let the command start in the background, go inside will stopped
The relationship between the stripping process and the terminal:
# nohup Command &
Jobs can view the job in the background: + means the first one out,-indicates the second one comes out
FG 2 can be transferred back to the front desk
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/96/ Wkiom1ybajvzrbrdaadk8wavjsq595.jpg "" 547 "height=" 185 "/>
BG: Start up a specified job in the background and let it run in the background
Kill% #终止指定作业
Process Priority tuning:
Adjust with nice value: can only be adjusted, the priority is small
Nice value: -20,19
Priority level: 100,139
Processes that have not been started:
Nice–n n Command
For a process that has started:
Renice–n N PID
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/96/ Wkiom1ybajurkdgjaabgldrek8s525.jpg "" 244 "height="/>
September 17 Process management, job management