linux进程管理杂记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux进程管理杂记相关的知识,希望对你有一定的参考价值。
命令
vmstat
vmstat
[[email protected] Packages]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 56 15876 38204 295152 0 0 4 3 21 18 0 1 99 0 0
每隔一秒刷新一次
[[email protected] Packages]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 56 15876 38244 295156 0 0 4 3 21 18 0 1 99 0 0
0 0 56 15876 38244 295156 0 0 0 0 19 18 0 0 100 0 0
每隔一秒刷新一次,刷5次
[[email protected] Packages]# vmstat 1 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 56 16016 38252 295156 0 0 4 3 21 18 0 1 99 0 0
0 0 56 16000 38252 295156 0 0 0 0 19 18 0 0 100 0 0
0 0 56 16000 38252 295156 0 0 0 0 15 19 0 0 100 0 0
0 0 56 16000 38252 295156 0 0 0 0 19 20 0 0 100 0 0
0 0 56 16000 38252 295156 0 0 0 0 18 22 0 0 100 0 0
显示内存统计数据
[[email protected] Packages]# vmstat -s
500920 total memory
485152 used memory
166076 active memory
209088 inactive memory
15768 free memory
38484 buffer memory
295160 swap cache
4194300 total swap
56 used swap
4194244 free swap
12253 non-nice user cpu ticks
1030 nice user cpu ticks
45577 system cpu ticks
13913975 idle cpu ticks
19671 IO-wait cpu ticks
2005 IRQ cpu ticks
56053 softirq cpu ticks
0 stolen cpu ticks
574569 pages paged in
365158 pages paged out
0 pages swapped in
14 pages swapped out
2913423 interrupts
2544112 CPU context switches
1465975126 boot time
19538 forks
pmap
显示进程1进程的内存映射表
[[email protected] Packages]# pmap 1
1: /sbin/init
00007fa85b25f000 52K r-x-- /lib64/libnss_files-2.12.so
00007fa85b26c000 2044K ----- /lib64/libnss_files-2.12.so
00007fa85b46b000 4K r---- /lib64/libnss_files-2.12.so
00007fa85b46c000 4K rw--- /lib64/libnss_files-2.12.so
00007fa85b46d000 1576K r-x-- /lib64/libc-2.12.so
00007fa85b5f7000 2048K ----- /lib64/libc-2.12.so
00007fa85b7f7000 16K r---- /lib64/libc-2.12.so
00007fa85b7fb000 8K rw--- /lib64/libc-2.12.so
00007fa85b7fd000 16K rw--- [ anon ]
00007fa85b801000 88K r-x-- /lib64/libgcc_s-4.4.7-20120601.so.1
00007fa85b817000 2044K ----- /lib64/libgcc_s-4.4.7-20120601.so.1
00007fa85ba16000 4K rw--- /lib64/libgcc_s-4.4.7-20120601.so.1
00007fa85ba17000 28K r-x-- /lib64/librt-2.12.so
00007fa85ba1e000 2044K ----- /lib64/librt-2.12.so
00007fa85bc1d000 4K r---- /lib64/librt-2.12.so
00007fa85bc1e000 4K rw--- /lib64/librt-2.12.so
00007fa85bc1f000 92K r-x-- /lib64/libpthread-2.12.so
00007fa85bc36000 2048K ----- /lib64/libpthread-2.12.so
00007fa85be36000 4K r---- /lib64/libpthread-2.12.so
00007fa85be37000 4K rw--- /lib64/libpthread-2.12.so
00007fa85be38000 16K rw--- [ anon ]
00007fa85be3c000 256K r-x-- /lib64/libdbus-1.so.3.4.0
00007fa85be7c000 2044K ----- /lib64/libdbus-1.so.3.4.0
00007fa85c07b000 4K r---- /lib64/libdbus-1.so.3.4.0
00007fa85c07c000 4K rw--- /lib64/libdbus-1.so.3.4.0
00007fa85c07d000 36K r-x-- /lib64/libnih-dbus.so.1.0.0
00007fa85c086000 2044K ----- /lib64/libnih-dbus.so.1.0.0
00007fa85c285000 4K r---- /lib64/libnih-dbus.so.1.0.0
00007fa85c286000 4K rw--- /lib64/libnih-dbus.so.1.0.0
00007fa85c287000 96K r-x-- /lib64/libnih.so.1.0.0
00007fa85c29f000 2044K ----- /lib64/libnih.so.1.0.0
00007fa85c49e000 4K r---- /lib64/libnih.so.1.0.0
00007fa85c49f000 4K rw--- /lib64/libnih.so.1.0.0
00007fa85c4a0000 128K r-x-- /lib64/ld-2.12.so
00007fa85c6ac000 20K rw--- [ anon ]
00007fa85c6be000 4K rw--- [ anon ]
00007fa85c6bf000 4K r---- /lib64/ld-2.12.so
00007fa85c6c0000 4K rw--- /lib64/ld-2.12.so
00007fa85c6c1000 4K rw--- [ anon ]
00007fa85c6c2000 140K r-x-- /sbin/init
00007fa85c8e4000 8K r---- /sbin/init
00007fa85c8e6000 4K rw--- /sbin/init
00007fa85d8d7000 244K rw--- [ anon ]
00007fff8e9b8000 84K rw--- [ stack ]
00007fff8e9d2000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 19344K
扩展选项显示进程1进程的内存映射表
[[email protected] Packages]# pmap -x 1
1: /sbin/init
Address Kbytes RSS Dirty Mode Mapping
00007fa85b25f000 52 20 0 r-x-- libnss_files-2.12.so
00007fa85b26c000 2044 0 0 ----- libnss_files-2.12.so
00007fa85b46b000 4 4 4 r---- libnss_files-2.12.so
00007fa85b46c000 4 4 4 rw--- libnss_files-2.12.so
00007fa85b46d000 1576 548 0 r-x-- libc-2.12.so
00007fa85b5f7000 2048 0 0 ----- libc-2.12.so
00007fa85b7f7000 16 8 8 r---- libc-2.12.so
00007fa85b7fb000 8 8 8 rw--- libc-2.12.so
00007fa85b7fd000 16 16 16 rw--- [ anon ]
00007fa85b801000 88 16 0 r-x-- libgcc_s-4.4.7-20120601.so.1
00007fa85b817000 2044 0 0 ----- libgcc_s-4.4.7-20120601.so.1
00007fa85ba16000 4 0 0 rw--- libgcc_s-4.4.7-20120601.so.1
00007fa85ba17000 28 20 0 r-x-- librt-2.12.so
00007fa85ba1e000 2044 0 0 ----- librt-2.12.so
00007fa85bc1d000 4 4 4 r---- librt-2.12.so
00007fa85bc1e000 4 0 0 rw--- librt-2.12.so
00007fa85bc1f000 92 56 0 r-x-- libpthread-2.12.so
00007fa85bc36000 2048 0 0 ----- libpthread-2.12.so
00007fa85be36000 4 4 4 r---- libpthread-2.12.so
00007fa85be37000 4 0 0 rw--- libpthread-2.12.so
00007fa85be38000 16 4 4 rw--- [ anon ]
00007fa85be3c000 256 208 0 r-x-- libdbus-1.so.3.4.0
00007fa85be7c000 2044 0 0 ----- libdbus-1.so.3.4.0
00007fa85c07b000 4 4 4 r---- libdbus-1.so.3.4.0
00007fa85c07c000 4 4 4 rw--- libdbus-1.so.3.4.0
00007fa85c07d000 36 28 0 r-x-- libnih-dbus.so.1.0.0
00007fa85c086000 2044 0 0 ----- libnih-dbus.so.1.0.0
00007fa85c285000 4 0 0 r---- libnih-dbus.so.1.0.0
00007fa85c286000 4 4 4 rw--- libnih-dbus.so.1.0.0
00007fa85c287000 96 84 0 r-x-- libnih.so.1.0.0
00007fa85c29f000 2044 0 0 ----- libnih.so.1.0.0
00007fa85c49e000 4 4 4 r---- libnih.so.1.0.0
00007fa85c49f000 4 4 4 rw--- libnih.so.1.0.0
00007fa85c4a0000 128 112 0 r-x-- ld-2.12.so
00007fa85c6ac000 20 4 4 rw--- [ anon ]
00007fa85c6be000 4 0 0 rw--- [ anon ]
00007fa85c6bf000 4 4 4 r---- ld-2.12.so
00007fa85c6c0000 4 0 0 rw--- ld-2.12.so
00007fa85c6c1000 4 0 0 rw--- [ anon ]
00007fa85c6c2000 140 48 0 r-x-- init
00007fa85c8e4000 8 4 4 r---- init
00007fa85c8e6000 4 4 4 rw--- init
00007fa85d8d7000 244 160 160 rw--- [ anon ]
00007fff8e9b8000 84 12 12 rw--- [ stack ]
00007fff8e9d2000 4 4 0 r-x-- [ anon ]
ffffffffff600000 4 0 0 r-x-- [ anon ]
---------------- ------ ------ ------
total kB 19344 1404 260
glaces
查看glances包信息
[[email protected] ~]# yum info glances
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Installed Packages
Name : glances
Arch : noarch
Version : 1.7.4
Release : 1.el6
Size : 534 k
Repo : installed
Summary : CLI curses based monitoring tool
URL : https://github.com/nicolargo/glances
License : GPLv3
Description : Glances is a CLI curses based monitoring tool for
: both GNU/Linux and BSD.
:
: Glances uses the PsUtil library to get information
: from your system.
:
: It is developed in Python.
恐怖
[[email protected] ~]# glances
zz.com (CentOS 6.8 64bit / Linux 2.6.32-642.el6.x86_64) Uptime: 1 day, 16:56:11
CPU 4.2% Load 1-core Mem 32.0% active: 173M Swap 0.0%
zz.com (CentOS 6.8 64bit / Linux 2.6.32-642.el6.x86_64) Uptime: 1 day, 16:56:30
CPU 3.8% Load 1-core Mem 32.0% active: 173M Swap 0.0%
zz.com (CentOS 6.8 64bit / Linux 2.6.32-642.el6.x86_64) Uptime: 1 day, 16:56:46
CPU 4.4% Load 1-core Mem 32.0% active: 173M Swap 0.0%
user: 2.2% nice: 0.0% 1 min: 0.23 total: 489M inactive: 196M total: 4.00G
system: 2.2% iowait: 0.0% 5 min: 0.08 used: 156M buffers: 38.9M used: 56K
idle: 95.6% irq: 0.0% 15 min: 0.06 free: 333M cached: 279M free: 4.00G
Network Rx/s Tx/s Tasks 117 (198 thr), 1 run, 116 slp, 0 oth sorted automatically
eth1 560b 12Kb
lo 0b 0b VIRT RES CPU% MEM% PID USER NI S TIME+ IOR/s IOW/s NAME
206M 12M 5.1 2.4 19954 root 0 R 0:06.62 0 0 /usr/bin/python /usr/bin/glances
Disk I/O In/s Out/s 19M 1M 0.0 0.3 1 root 0 S 0:18.64 0 0 /sbin/init
sda1 0 0 0 0 0.0 0.0 2 root 0 S 0:00.40 0 0 kthreadd
sda2 0 0 0 0 0.0 0.0 3 root 0 S 0:00.00 0 0 migration/0
sda3 0 0 0 0 0.0 0.0 4 root 0 S 1:41.87 0 0 ksoftirqd/0
sda4 0 0 0 0 0.0 0.0 5 root 0 S 0:00.00 0 0 stopper/0
sda5 0 0 0 0 0.0 0.0 6 root 0 S 0:35.81 0 0 watchdog/0
sda6 0 0 0 0 0.0 0.0 7 root 0 S 12:47.40 0 0 events/0
sda7 0 0 0 0 0.0 0.0 8 root 0 S 0:00.00 0 0 events/0
sda8 0 0 0 0 0.0 0.0 9 root 0 S 0:00.00 0 0 events_long/0
sda9 0 0 0 0 0.0 0.0 10 root 0 S 0:00.00 0 0 events_power_ef
0 0 0.0 0.0 11 root 0 S 0:00.00 0 0 cgroup
Mount Used Total 0 0 0.0 0.0 12 root 0 S 0:00.00 0 0 khelper
/ 340M 19.6G 0 0 0.0 0.0 13 root 0 S 0:00.00 0 0 netns
/boot 33.0M 190M 0 0 0.0 0.0 14 root 0 S 0:00.00 0 0 async/mgr
/home 22.1M 9.49G 0 0 0.0 0.0 15 root 0 S 0:00.00 0 0 pm
/tmp 11.8M 5.64G 0 0 0.0 0.0 16 root 0 S 0:11.70 0 0 sync_supers
Press ‘h‘ for help
glaces使用C/S模式
服务器模式:
glances -s -B 10.201.106.128
客户端模式:
glances -c 10.201.106.128
dstat
dstat
[[email protected] ~]# dstat
Terminal width too small, trimming output.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-->
usr sys idl wai hiq siq| read writ| recv send| in out >
0 0 99 0 0 0|3739B 2487B| 0 0 | 0 0 >
1 0 99 0 0 0| 0 0 | 60B 714B| 0 0 >
0 0 100 0 0 0| 0 0 | 60B 314B| 0 0 >
0 1 99 0 0 0| 0 0 | 60B 314B| 0 0 >^C
显示全部磁盘和sda信息
[[email protected] ~]# dstat -D total,sda
Terminal width too small, trimming output.
----total-cpu-usage---- -dsk/total----dsk/sda-- -net/total->
usr sys idl wai hiq siq| read writ: read writ| recv send>
0 0 99 0 0 0|3733B 2484B:3698B 2484B| 0 0 >
0 1 99 0 0 0| 0 0 : 0 0 | 120B 790B>
0 0 100 0 0 0| 0 0 : 0 0 | 60B 314B>
0 0 100 0 0 0| 0 0 : 0 0 | 60B 314B>
1 0 99 0 0 0| 0 0 : 0 0 | 60B 314B>
0 0 100 0 0 0| 0 0 : 0 0 | 60B 314B>^C
显示CPU0和sda
[[email protected] ~]# dstat -D total,sda -C 0
Terminal width too small, trimming output.
-------cpu0-usage------ -dsk/total----dsk/sda-- -net/total->
usr sys idl wai hiq siq| read writ: read writ| recv send>
0 0 99 0 0 0|3731B 2482B:3696B 2482B| 0 0 >
0 0 100 0 0 0| 0 0 : 0 0 | 120B 730B>
0 0 100 0 0 0| 0 0 : 0 0 | 60B 314B>
0 0 100 0 0 0| 0 0 : 0 0 | 60B 314B>
1 0 99 0 0 0| 0 0 : 0 0 | 60B 314B>^C
显示中断的统计数据
[[email protected] ~]# dstat -i
----interrupts---
17 18 19
0 0 1
0 0 2 ^C
只显示负载
[[email protected] ~]# dstat -l
---load-avg---
1m 5m 15m
0.01 0.03 0.05
0.01 0.03 0.05
0.01 0.03 0.05
只显示网络和内存的相关信息
[[email protected] ~]# dstat -n
-net/total-
recv send
0 0
60B 202B
60B 154B^C
[[email protected] ~]# dstat -m
------memory-usage-----
used buff cach free
152M 38.5M 278M 21.1M
152M 38.5M 278M 21.1M
显示进程统计数据
[[email protected] ~]# dstat -p
---procs---
run blk new
0 0 0.1
0 0 0
swap相关的统计数据
[[email protected] ~]# dstat -s
----swap---
used free
56k 4096M
56k 4096M
56k 4096M^C
时间输出
[[email protected] ~]# dstat -t
----system----
date/time
17-06 12:04:41
17-06 12:04:42
17-06 12:04:43^C
显示ipc(进程通信)的相关信息
[[email protected] ~]#
[[email protected] ~]# dstat -ipc
----interrupts--- ---procs--- ----total-cpu-usage----
17 18 19 |run blk new|usr sys idl wai hiq siq
0 0 1 | 0 0 0.1| 0 0 99 0 0 0
3 0 1 | 0 0 0| 0 0 100 0 0 0
0 0 3 | 0 0 0| 0 0 100 0 0 0^C
显示TCP连接
[[email protected] ~]# dstat --tcp
----tcp-sockets----
lis act syn tim clo
13 1 0 0 0
13 1 0 0 0
13 1 0 0 0
显示最消耗CPU的进程
[[email protected] ~]# dstat --top-cpu
-most-expensive-
cpu process
events/0 0.5
events/0 1.0
显示最消耗内存的进程
[[email protected] ~]# dstat --top-mem
--most-expensive-
memory process
mysqld 15.0M
mysqld 15.0M
mysqld 15.0M^C
显示延迟最大的进程
[[email protected] ~]# dstat --top-latency
--highest-total--
latency process
events/0 1671
pickup 289
events/0 57
events/0 50
events/0 53^C
kill
列出kill命令所能发出的信号
[[email protected] ~]# kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+1247) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-1352) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
启动http服务
[[email protected] ~]# systemctl start httpd
查看httpd服务状态
[[email protected] ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2016-07-25 15:46:40 CST; 1min 38s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 15413 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─15413 /usr/sbin/httpd -DFOREGROUND
├─15415 /usr/sbin/httpd -DFOREGROUND
├─15416 /usr/sbin/httpd -DFOREGROUND
├─15417 /usr/sbin/httpd -DFOREGROUND
├─15418 /usr/sbin/httpd -DFOREGROUND
└─15419 /usr/sbin/httpd -DFOREGROUND
Jul 25 15:46:07 qq systemd[1]: Starting The Apache HTTP Serv....
Jul 25 15:46:18 qq httpd[15413]: AH00557: httpd: apr_sockadd...q
Jul 25 15:46:18 qq httpd[15413]: AH00558: httpd: Could not r...e
Jul 25 15:46:40 qq systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
正常中止进程
[[email protected] ~]# kill -15 15416
[[email protected] ~]# kill -SIGTERM 15449
[[email protected] ~]# kill -TERM 15449
通过进程名杀死其相关所有进程
[[email protected] ~]# killall -15 httpd
无须关闭进程重新读取配置文件
[[email protected] ~]# killall -HUP httpd
作业
前台作业隐藏于后台,然后调出来
[[email protected] ~]# top
top - 14:00:24 up 1 day, 22:41, 2 users, load average: 0.01,
Tasks: 115 total, 1 running, 114 sleeping, 0 stopped, 0 z
Cpu(s): 2.7%us, 0.0%sy, 0.0%ni, 97.3%id, 0.0%wa, 0.0%hi,
Mem: 500920k total, 483208k used, 17712k free, 38156
Swap: 4194300k total, 56k used, 4194244k free, 295284
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
21479 root 20 0 15032 1208 924 R 2.7 0.2 0:00.10
1 root 20 0 19344 1404 1144 S 0.0 0.3 0:19.13
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00
4 root 20 0 0 0 0 S 0.0 0.0 1:42.17
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00
6 root RT 0 0 0 0 S 0.0 0.0 0:35.88
7 root 20 0 0 0 0 S 0.0 0.0 13:11.72
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00
16 root 20 0 0 0 0 S 0.0 0.0 0:11.25
17 root 20 0 0 0 0 S 0.0 0.0 0:14.65
18 root 20 0 0 0 0 S 0.0 0.0 0:00.00
[1]+ Stopped top
[[email protected] ~]# fg
top
top - 14:01:08 up 1 day, 22:42, 2 users, load average: 0.00,
Tasks: 115 total, 1 running, 114 sleeping, 0 stopped, 0 z
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi,
Mem: 500920k total, 483496k used, 17424k free, 38172
Swap: 4194300k total, 56k used, 4194244k free, 295288
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
1 root 20 0 19344 1404 1144 S 0.0 0.3 0:19.13
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00
4 root 20 0 0 0 0 S 0.0 0.0 1:42.17
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00
6 root RT 0 0 0 0 S 0.0 0.0 0:35.88
7 root 20 0 0 0 0 S 0.0 0.0 13:11.76
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00
查看当前有多少作业
[[email protected] tmp]#
[[email protected] tmp]# jobs
[1] Stopped vim fstab
[2]- Stopped htop
[3]+ Stopped dstat
nice调整进程优先级
[[email protected] tmp]# nice -n 5 htop
[3]+ Stopped nice -n 5 htop
[[email protected] tmp]# ps axo pid,comm,ni | grep htop
21524 htop 0
21602 htop 5
[[email protected] tmp]#
对已经运行的进程更改nice值
[[email protected] tmp]# renice -n 2 21602
21602: old priority 5, new priority 2
以上是关于linux进程管理杂记的主要内容,如果未能解决你的问题,请参考以下文章
LINUX PID 1和SYSTEMD PID 0 是内核的一部分,主要用于内进换页,内核初始化的最后一步就是启动 init 进程。这个进程是系统的第一个进程,PID 为 1,又叫超级进程(代码片段