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

Process management under linux (basic understanding of processes and viewing pstree,p

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Process Management under Linux

1. What is the process?

A program is a static file

A process is a copy of a running program

The process has a life cycle (preparation period, operation period, termination period).

two。 Process status

State definition R (TASK_RUNNING), executable state (RUNNING,READY) running: being processed ready: in queue, the number of cpu processing processes is limited S (TASK_INTERRUPTIBLE) wakeable state: the time used on the cpu timed out and is put into a dormant state, with the call of the program will be awakened D (TASK_UNINTERRUPTIBLE) unawakable state T (TASK_STOPPED) pause state: enter the background, pause artificial control Z (EXIT_ZOMBIE) zombie: the parent process ends first, so the child process is not recycled to view the process

1.pstree command

Pstree

Process is the smallest unit of resource allocation

A thread is the smallest unit in which a process runs.

Systemd daemon: the leader of the process, initializing the process

General usage of 2.ps command

Ps display current command execution time process state parameter effect a display terminal-related processes (BSD) x display all process-independent processes (BSD) u display process status f hierarchy display process information o specify viewing option pid,comm,nice,pri,pcup,stat Ppid-e displays all processes (unix)-f displays full format information (unix)-H hierarchy displays information about the process-o specifies the viewing option pid,comm,nice,%cpu,%mem,nice

* ps display command

Field interpretation USER user name PID process id%CPUcpu usage% MEM memory usage% VSZ occupies virtual memory size RSS resident memory set size TTY character terminal STAT process state START run time TIME occupies cpu time COMMAND process name

Note: the title of the first behavior when viewing

3 process filtering command pgrep

Ps aux | grep root filtering superuser (users will display, and keywords with root lines will be inaccurate)

So

Pgrep

Pgrep display specified process parameter effect-u uid display specified user process-U name display specified user process-t tty display specified terminal process-l display process name-a display full format process name-P pid shows the child processes of the specified process

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

Servers

Wechat

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

12
Report