Simply list the basic commands and share only my thoughts!
based on Linuxkernel is multi-tasking OS,Windows NT Kernel is a single multitasking os,os Kernel features nothing but "connecting" That is, drive hardware, provide system calls for upper-level applications, memory management,FS Management, Process management , and so on, so the Linux process, threading mechanism and Windows have Some differences, I'm talking about the principle.
Of course, the binary program files must be different, because the process is the application to the kernel, by the kernel "approval" before it can become a process.
kernel Kernel in-memory created task_struct Kernel Kernel
estimated that some of the brothers are confused, why not let the process themselves "live in" memory, because one of the functions of Kernel is to deal with hardware,CPU instructions Run is also graded, from inside to outside is Ring0-ring3, in which ordinary process operations can enter Ring3 but with hardware, Must be RING0 level of operation instructions, this part of the instruction only Kernel have permission to operate, so, there will be a system call, that is, the normal process requires the use of hardware resources, and no permissions, had to find Kernel to solve, This is the system call.
a single-core The CPU can only do one thing at a time, not two things at the same time the CPU processing, it is the same as your brain, you can draw the left hand side of the circle? Or, can you write a composition and do a math problem at the same time? CPU is the same, one process of processing a request, if it is multi-core CPU, but also want to let the same process in multi-core running simultaneously, it is necessary to introduce threads, it is like "Naruto practice", to see the shadow of all know, Naruto copy several of their own, and then all practice "spiral pill", then, all the replicators back to the main body, so that all of a sudden do a lot of things, this is the role of threading.
In fact, the process also has a scheduling mechanism, after all, the computer can not be only a process, a lot of process to use priority to decide who first to execute, who executes, internal mechanism content, due to limited time, in the latter several blog, will detail the real-time priority process, static priority process.
Introduced a half-day, process and thread, mainly to introduce two system monitoring tools and a process viewing tool.
1, real-time system monitoring Tool Dstat,1
DSTAT[-AFV] [options:] [Delay [Count]]
-A: Display cdngy
-C: Displays statistics of CPU performance metrics
-D: Disk read and Write rate
-G: Display memory page data swap out
-I: Show interrupt-related rate data
-L:--load, showing average load statistics
-M: memory-related statistics
-N: Displays the rate of data sent to and from the network BYTES/S
-neth#: Display information for a NIC
-P: Show process-related rate data, including queue length, non-interruptible queue length, and new process rate
-R:--io, rate of I/O requests
-S: Show swap -related data
-y: Displays system statistics, including interrupts and process transitions
--TOP-CPU: Show CPU-intensive processes
--top-bio: The process that consumes block I/O most
--top-cputime: The process that consumes the most CPU cumulative duration
--top-io: Most I/O -intensive process
--top-mem: The most memory-intensive process
--IPC: Show rate data related to interprocess communication
--raw: Displaying bare socket-related data
--sockets: Displays socket-related data, including TCP,UDP, and Raw
--tcp: Displaying tcp -related socket-related data
--UDP: Displaying UDP -related socket-related data
--unix: Displays statistics about the Unix sock interface
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6B/7B/wKiom1UufymCL7d9AAPH8nhc_g8844.jpg "title=" Figure 1.jpg "alt=" Wkiom1uufymcl7d9aaph8nhc_g8844.jpg "/>
Figure 1
2, real-time monitoring tool glances,2
Glances [-bdehmnrsvyz1][-b bind][-c server][-c conffile][-p port][-ppassword][--password][-t refresh][-f file][-o Output
Common options:
-B: display network card device data exchange rate in bytes/s units
-D: Do not display the disk I/O function Module
-F File-o {HTML | CSV}: Setting the location and format of the output file
-M: Close mount module
-N: Turn off network function module
-R: Do not display the Process List module
-T: Specify the length of delay, default is 3s
-1: Separate display of CPU-related information
Interactive Commands:
A: automatic sorting
C: More CPU usage sequencing
M: Sort by memory consumption ratio
P: Sort by process name
I: more I/o rate sequencing
D: Show or hide disk I/O status
F: Show or hide file system status
N: Show or hide network status
S: Show or hide sensors status
Y: The system that is or hides the hddtemp State
b: Check the network card exchange rate
L: View or hide logs
W: Delete warning log
X: Delete warnings and severity logs
T: View network I/O totals
U: View Total network I/O
1: Switch CPU
Remote mode support:
SERVER: Start glances
Glance-s-B ipaddr
-B: Used to indicate the server address of the listener
CLIENT: Start glances in remote mode , connect to the server remotely, and the relevant data on the server
Glance-c server-ipaddr
indicate the address of the server
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6B/7B/wKiom1Uuf8CTjfouAAa0LZ59I6s744.jpg "title=" Image 2. JPG "alt=" wkiom1uuf8ctjfouaaa0lz59i6s744.jpg "/>
Figure 2
3. Real-time process viewing tool:htop,3
Interactive commands:
U: Filter only shows users ' processes
S: The user tracks the system call of the selected process, switching the kernel execution
l; Specifies that all files opened by the selected process are equivalent to lsof
T: Show hierarchy of Processes
A: Used to bind the specified process to a CPU
H: Hide or show the user's thread
K: Hide or show kernel threads
P: Sort by CPU percent
M: Sort by memory usage percentage
T: Sort by Time length
Options:
-D #: Delay time, that is, the length of the brush screen
-U USERNAME: Displays only the processes of the specified user
-S COLUMN: Sort According to the specified field
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6B/7B/wKiom1UugCyDNIMXAAiJ_6jUxgs041.jpg "title=" Image 3. JPG "alt=" wkiom1uugcydnimxaaij_6juxgs041.jpg "/>
Figure 3
In fact, if you understand the process, thread, process scheduling,interrupt, and so on, can understand these commands, the key is to practice, I will be in the back of the blog constantly updated about content, have like-minded "comrades" can add my qq: 865765761.
This article is from the webcast blog, so be sure to keep this source http://damihua.blog.51cto.com/6537272/1633202
Linux system Monitoring Tools Dstat, glances and real-time Process View tool htop (with partial process principle)