1. System Monitoring
1) Tools for system monitoring and Process Control----> TOP and free Windows-like resource Manager.
Three states that the process is running:
Tips
Process is a computer program on a data set on a running activity, the system is the basic unit of resource allocation and scheduling, is the basis of the operating system structure.
Explain the zombie process with the orphan process:
Refer to the blog: http://blog.csdn.net/l953972252/article/details/51399576
Zombie Process: A process uses fork to create a child process, and if the child process exits, and the parent process does not call wait or waitpid to get state information for the child process, the process descriptor of the child process is still stored in the system. This process is called a zombie process. Features: Take-up process PID number, can not be released, affect system resources.
Orphan process: Orphan process: A parent process exits, and one or more of its child processes are still running, then those child processes will become orphans. The orphan process will be adopted by the INIT process (process number 1) and the Init process completes the state collection for them. Features: does not occupy system resources, because the system is eventually recycled.
handling of zombie processes
It concludes that the orphan process does not account for resources and that the zombie process consumes the resource-endangering system. We should avoid the advent of zombie processes.
The solution is as follows:
1) via signal mechanism
A sigchild signal is sent to the parent process when the child process exits, and the parent process processes the sigchild signal. Call Wait () or waitpid () to cause the parent process to block waiting for the zombie process to appear and finish running the parent process.
2) Kill the parent process
When the parent process is stuck in a dead loop, such that the zombie process cannot be processed, and the parent process is forced to kill, then its child process, the zombie process, becomes an orphan process, which is reclaimed by the system.
3) Rebooting the system
When the system restarts, all processes are stopped when the system shuts down, including the zombie process, and the INIT process reloads other processes when it is turned on.
The top command looks at the system status:
CPU Utilization : The last day of the class time is 8 hours, while the code of the number of farmers to tap the time of 2 hours, 2/8=0.25, 25% is the yard in a day's time utilization (normal situation, CPU utilization <70%)
CPU Load : The company in a minute for a number of farmers to arrange 3 tasks, and 1 minutes in the yard to do 6 tasks, then the yard load of one minute is 0.5
CPU load <=1: can handle normally
CPU Load >1: overload operation
tasks:29 Total |
Total number of processes |
1 Running |
Number of processes that are running |
Sleeping |
Number of processes for sleep |
0 stopped |
Number of processes stopped |
0 Zombie |
Number of zombie processes |
Cpu (s): 0.3% US |
Percentage of CPU occupied by user space |
1.0% Sy |
Percentage of CPU consumed by kernel space |
0.0% ni |
CPU percentage of processes that have changed priority in user process space |
98.7% ID |
Percentage of idle CPU |
0.0% WA |
Percentage of CPU time waiting for input and output |
0.0% hi |
Percent of CPU time consumed by hardware interrupts |
0.0% si |
Percentage of CPU time that software interrupts consume |
The free command shows the use state of the memory: (Take Centos7 as an example)
CPU utilization = (total-available)/available
---buffer write cache, save to disk buffer and then write to permanent space when data is stored
---Cache read caching, the data is read out of the disk, persisted in the buffer, the preparation program next use
In fact, the memory is equivalent to the external buffer and the cache for the CPU and hard disk to use;
when we write the data and save, the amount of our cache data will be greatly improved, because it is saved on the hard disk while still in memory, convenient for users to re-use, so as not to call back and forth hard disk data caused by slow speed "running speed:cpu> Memory > Hard disk". However, we can use the following (1) command to release the cache space occupied by this data, but we cannot completely release the cache space because some system files are protected.
(1). Release system data that was consumed by the system cache:
3
It is important to note that there is free
no memory currently being used by the program at all, and that it cache
can be freed for other processes to use if necessary (not all, of course, cache
can be freed, such as the memory currently being used ramfs
). available
to actually show the memory that the system can currently provide to the application.
2) Monitoring PS in the process of the system
1> Parent and child processes: When a process creates another process, the 1th process is called the parent process of the new process, and the new process is called a child process.
2> Mastering the functions of the PS command: used to display the status of the current process.
Ps–aux Show all the user-related complete information
Monitoring of processes in the system pstree, kill
centos7 Default No Pstree, requires yum-y install Psmisc
1) pstree command; display the program in a tree-like chart
Usage: For example, the process Tree command for a process with PID 789 is: Pstree 789
Kill command; Sends a signal to one or more processes, sending a terminating signal by default.
usage: Terminate the command for a process with PID 3852: Kill 3852
Kill-9: Kill the command for a process with a PID of 3906 kill-9 3906
pgrep command; Find a process by name or other property
Usage: Find the command for the process named Firefox: pgrep Firefox
Pkill command; Send a signal to a process by name or other attribute
Usage: the command to kill a process named Firefox is: Pkill Firefox
2. Hard disk partitioning and formatting (see the Youdao Cloud Note for details)
3. File System Management
Linux system monitoring and hard disk partitioning/formatting/file System Management