Linux centos7: programs and processes

A program is code stored on the hard disk, while a process is a runtime instance that has been loaded into memory. Multiple processes can run the same program at the same time and work independently of each other in the operating system.

In the CentOS7 operating system, programs and processes are critical to the normal operation and stability of the system. Here are some aspects of their importance:

1. Start the application : A program is code that accomplishes a specific task. In order to run a program, it must be loaded into memory and a process created. In CentOS7, the correct startup and management of programs and processes is very important. Only when the program is loaded and run correctly can it perform tasks in the system.

2. System security : CentOS7 system runs multiple processes, each process is isolated, any process failure or crash will not affect other processes. In addition, processes are independent of each other, and they cannot access each other's memory or files without explicit permission, thereby protecting the security of the system.

3. Task management : Process management is a very important part of the CentOS7 operating system. Functions such as the creation of new processes, the allocation of processes and resources, the priority and scheduling of processes, and the transmission of process signals all involve process management. Proper process management can optimize resource utilization and improve system responsiveness and performance.

4. System performance : In CentOS7, multiple processes can run in the system for multitasking. Proper process management can control the use of system resources, thereby improving the performance and efficiency of the system. In addition, an appropriate process scheduling strategy can optimize system performance, improve concurrent processing capabilities, and meet system performance requirements.

In the CentOS7 operating system, there are some commonly used commands to manage programs and processes. The following are some of the commonly used commands:

1. ps command : used to list the running processes in the current system, including process ID, process name, process status, process startup time, occupied memory size and other information. Command format: ps aux

2. top command : It is used to view the running status of the processes in the system in real time. It can be sorted by CPU usage rate or memory usage rate, etc., or it can dynamically operate processes in interactive mode. Command format: top

3. kill command : used to stop the running process. Command format: kill [option] PID, where option can be one of parameters such as -9 (forcibly terminate the process), -15 (gracefully terminate the process).

4. pstree command : used to display the process tree of all processes in the system, you can view the parent-child relationship between processes. Command format: pstree [option]

5. Service command : used to control system services, start and stop services, and start services automatically when booting. Command format: service [option] service_name

In addition to the above commands, there are other commonly used commands, such as:

- systemctl command: used to manage services and unit files in the system

- top command: As mentioned above, it is a process monitor

- nice command: adjust the priority of the process

- renice command: used to modify the priority of an already running process

- ifconfig command: used to configure network interface parameters

These commands are basic tools for program and process management in the CentOS7 system, which can help users monitor, control and manage processes and programs in the system.

The ps command is a commonly used command to view the running processes in the current system

The ps command will list the following information:

1. USER: the user to which the process belongs

2. PID: Process ID

3. %CPU: The proportion of CPU used by the process

4. %MEM: The proportion of memory used by the process

5. VSZ: The size of virtual memory used by the process (in KB)

6. RSS: the actual memory size occupied by the process (in KB)

7. TTY: The terminal type of the process

8. STAT: The status of the process, including R (running), S (sleep), D (uninterruptible sleep), Z (zombie process), etc.

9. START: The start time of the process

10. COMMAND: The command name and parameters corresponding to the process

The ps command also supports a variety of parameters, such as -a (display all user processes), -e (display all processes), etc., you can choose and use according to your needs.

top is a command to monitor the resource usage of processes in the system in real time.

The following is what the top command can view:

1. The current time and the continuous running time of the system are displayed at the beginning of the line

2. Load average: Display the average load of the system. Including 1-minute, 5-minute, and 15-minute average loads to evaluate system resource utilization.

3. Tasks: Displays the number of active processes (including running processes, sleeping processes, zombie processes, etc.).

4. CPU: Display the CPU utilization.

5. Memory: Displays the usage of physical memory and swap space.

6. Swap: The usage of the swap partition.

7. PID: The ID of the process.

8. USER: The owner of the process.

9. %CPU: The CPU usage rate used by the process.

10. %MEM: The percentage of memory occupied by the process.

11. TIME+: CPU time used by the process.

12. VIRT: The size of virtual memory used by the process.

13. RES: The actual memory size used by the process.

14. SWAP: The usage of the process swap partition.

15. NI: The priority of the process.

16. COMMAND: The command name and parameters corresponding to the process.

You can use the top command to view the running status of the processes in the system, and adjust the priority of the process, stop the process, etc. as needed.

In short, the correct use and management of programs and processes in CentOS7 play an important role in the normal operation, security, task management and performance of the system.

Guess you like

Origin blog.csdn.net/weixin_63294004/article/details/130448370