Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of Linux process and job management

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of the Linux process and the method of job management, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this Linux process and the method of job management. Let's take a look at it.

I. process viewing and its management tools

Ps command: reports snapshot information for the current process

Ps-report a snapshot of the current processes.

Options:

-A: shows that all processes have the same effect as-e

-a: all processes not related to the terminal

-u: processes related to the user

-x: usually used in combination with aforme u to show more comprehensive information

-f: make a more complete output

Common combinations:

Ps-ef displays all process information with complete information

Ps-efH displays the process hierarchy

Ps-aux displays complete information about all processes that are not terminal-related and terminal-related

Ps-axo pid,command,psr,pri,ni customizes to display its process number, process command, priority, and nice value.

Command demonstration:

UID/PID/PPID: indicates initiator, process number, and parent process number

C: stands for CPU, in percentage

STIME: indicates the start time of the process

TTY: the terminal location of the logger

Elapsed time of TIME:cpu

CMD: penalty process command

Command demonstration:

USER: initiator of the process

PID: process number

Occupancy of% CPU:cpu

% MEM: memory occupancy

VSZ: virtual memory set

RSS: physical memory set

TTY: terminal location

STAT: process status information

START: the time when it was triggered

Usage time of TIME:cpu

COMMAND: trigger process command

* * Note: * * Common status of STAT:

R:running, operational statu

S:interruptible sleeping, but terminal hibernation

D:uninterruptible sleeping, non-terminal hibernation

T:stop, stop statu

Z:zombie, stalemate

Top command:

Top-display Linux tasks: dynamic display of linux process information top-17:24:30 up 2 days, 9:45, 3 users, load average: 0.00,0.01,0.05

Top current system time total length of users average load since system startup

Tasks: 364 total, 2 running, 361 sleeping, 1 stopped, 0 zombie

Displays the total amount of processes and the state of individual programs: running interruptible uninterruptible deadlock, deadlock

% Cpu (s): 0.3 us, 0.7 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

Displays the overall load of the CPU, as follows:

Us:user space is used to use space

Percentage of cpu occupied by sy:system space kernel

Percentage of cpu occupied by processes whose priority has been changed by ni:nice user process space

Percentage of id:idle idle cpu

It takes time for wa:wait iUnite0 to wait for iUniverse.

Hi:hardware interrupt

Si:software interrupt

St:stolen, percentage stolen by virtual memory

KiB Mem: 1001332 total, 139212 free, 207732 used, 654388 buff/cache

Physical memory footprint USA

KiB Swap: 2098172 total, 2097620 free, 552 used. 531424 avail Mem

Usage of swap Partition

The above line is usually blank and is displayed only when you enter a command. The commands that can be entered here are as follows:

P: sort processes by percentage of cpu occupied

M: sort by occupied memory size

T: sort by the running time of cpu

L: show system load lines

T: whether to display the summary information of the system process and the load status of cpu

1: average or separately display the load status of the cpu

M: whether to display memory-related status information

Q: exit command

S: modify to extend refresh time

K: terminates the specified process

Detailed description of top field:

PID: process number

USER: process initiator

PR: the priority of the process. The smaller the priority, the better.

NI: nice value, which is related to priortity. The smaller the value, the earlier it is run.

VIRT: virtual memory set processes occupy virtual memory space

RES: physical memory set processes occupy actual memory space

SHR: the amount of memory shared by a process with other processes

S: status information of the process

% CPU:cpu usage percentage

% MEM: percentage of memory used

The total duration of the use of TIME+:cpu

COMMAND: process-related commands

Htop command: internal process viewer

Htop-interactive process viewer

U: displays the process of the specified user

L: displays a list of files opened by the process where the cursor is located

S: displays the system call executed by the process where the cursor is located

A: bind the process to the specified cpu

#: quickly locate the process where the pid of the cursor is #

Options supported by htop:

-d: extended duration

-u USERNAME: displays only the processes of the specified user

-s COLUMN: sort by specified field

II. Linux process and job management

1. Process management

The so-called process management is to send some control signals to the process to complete the management and control of the process. The kill command can be used to display the signals available to the current system and send signals to the process to specify. Kill-l: displays the signals available to the current system

Kill command: used to signal the process to manage the process

Kill-terminate a process

Each signal can be identified in three ways: 1) the digital identification of the signal; 2) the complete name of the signal; 3) the abbreviated name of the signal signals to the process: kill [- s signal |-p] [-] pid. The common signals of kill-l [signal] are: 1) SIGHUB # does not need to shut down the process to reread the configuration file kill-1 pid 2) SIGINT # terminates a running instruction equivalent to ctrl+c kill-2 pid 9) SIGKILL # violently kills the running process kill-9 pid 15) SIGNTERM# securely terminates the running process kill-15 pid 19) SIGSTOP # stop the process killall command: killall command followed by the process name

Killall-kill processes by name

2. Job management

After each user logs in to the system, each work process is a child process of the current bash. At this time, we need to manage those processes, that is, to put some jobs to run in the background, edit a configuration file in the foreground at the same time, and then transfer the background job tasks back to the foreground to run after editing the configuration file. How to run a job in the background: 1) ctrl+z 2) command &

Job control command: fg bg kill

Job control commands:

# fg [[%] JOBNUM]: returns the specified job to the foreground

# bg [[%] JOBNUM]: let jobs sent to the background continue to run in the background

# kill [% JOBNUM]: terminates the specified action

This is the end of the article on "what are the methods of Linux process and homework management". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the methods of Linux process and homework management". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report