我已经读过了这个答案但就我而言,我感到困惑的是,仅启动 chrome,只打开一个选项卡(谷歌),就会给我以下输出ps -aux | grep chrome
:
38.2 1.3 906908 213872 tty1 SLl+ 10:58 0:02 /opt/google/chrome/chrome
0.4 0.3 431084 52732 tty1 S+ 10:58 0:00 /opt/google/chrome/chrome --type=zygote --no-zygote-sandbox
0.4 0.3 431084 52360 tty1 S+ 10:58 0:00 /opt/google/chrome/chrome --type=zygote
0.0 0.0 27332 4204 tty1 S+ 10:58 0:00 /opt/google/chrome/nacl_helper
0.1 0.0 431084 15216 tty1 S+ 10:58 0:00 /opt/google/chrome/chrome --type=zygote
10.8 0.9 709252 149584 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=gpu-process --field-trial-handle=1441856381286841073,7865066266003832000,131072 --gpu-preferences=QAAAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAABgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAA --shared-files
10.2 0.5 529892 84036 tty1 SLl+ 10:58 0:00 /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --service-sandbox-type=network --shared-files=v8_context_snapshot_data:100
0.5 0.2 475520 36340 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=utility --utility-sub-type=storage.mojom.StorageService --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --service-sandbox-type=utility --shared-files=v8_context_snapshot_data:100
0.0 0.1 517864 31208 tty1 S+ 10:58 0:00 /opt/google/chrome/chrome --type=broker
4.5 0.6 4768136 101568 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=10 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
8.7 0.6 4769868 110192 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=9 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
1.2 0.5 4754992 89304 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --extension-process --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=5 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
1.1 0.5 4745764 81900 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --extension-process --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=6 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
1.1 0.4 4747812 79564 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --extension-process --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=7 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
3.1 0.5 4762152 90288 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --extension-process --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=8 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
2.1 0.5 4760104 83992 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --extension-process --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=11 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
4.5 0.6 4765288 103976 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=12 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
0.0 0.1 469756 29404 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=utility --utility-sub-type=data_decoder.mojom.DataDecoderService --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --service-sandbox-type=utility --shared-files=v8_context_snapshot_data:100
0.5 0.3 4736288 51700 tty1 Sl+ 10:58 0:00 /opt/google/chrome/chrome --type=renderer --field-trial-handle=1441856381286841073,7865066266003832000,131072 --lang=en-US --disable-client-side-phishing-detection --origin-trial-disabled-features=SecurePaymentConfirmation --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=17 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100
0.0 0.0 14432 1116 pts/0 R+ 10:58 0:00 grep --color=auto chrome
特别是--gpu-preferences=QAAAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAABgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAA --shared-files
?? 编辑:找到答案这里
输出nvidia-smi
:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04 Driver Version: 450.102.04 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce MX150 Off | 00000000:01:00.0 Off | N/A |
| N/A 43C P0 N/A / N/A | 521MiB / 2002MiB | 3% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1492 G /usr/lib/xorg/Xorg 204MiB |
| 0 N/A N/A 1876 G /usr/bin/gnome-shell 153MiB |
| 0 N/A N/A 15171 G ...gAAAAAAAAA --shared-files 135MiB |
| 0 N/A N/A 21514 G ...AAAAAAAAA= --shared-files 25MiB |
+-----------------------------------------------------------------------------+
我使用 Ubuntu 18.04
运行这么多进程正常吗?
答案1
这实际上并不能回答 Chrome 为何启动如此多进程,而更多地表明 Chrome 总体上比其他浏览器使用更多的资源。 我以 Firefox 为例对其进行了比较。
网络浏览器在启动时会占用 CPU 和 RAM。不幸的是,您不仅要启动网络浏览器,还要启动插件等。此外,网络浏览器在系统中的实际运行方式以及他们认为需要同时运行的内容在很大程度上取决于网络浏览器的程序员。
以下使用inxi
(我最喜欢的查看系统使用情况的工具之一) 查看 Chrome 和 Firefox 的 CPU 和 RAM 使用情况的对比。
从前 1000 个 CPU 和 RAM 列表的示例inxi
以及两个浏览器都打开了 1 个选项卡的情况来看。从这些示例中,我们可以看到 Firefox 的整体 CPU 使用率比 Chrome 要高一点。但是,我们也可以看到 Chrome 的整体 RAM 使用率更高。这在很大程度上取决于您想要使用哪种浏览器的偏好。
CPU使用率:
terrance@terrance-ubuntu:~$ inxi -t c1000 | grep -E "firefox|chrome"
1: cpu: 17.3% command: firefox pid: 3910531
3: cpu: 9.5% command: firefox pid: 3910586
4: cpu: 6.2% command: firefox pid: 3910656
6: cpu: 4.7% command: chrome pid: 3900194
8: cpu: 2.0% command: firefox pid: 3910707
9: cpu: 1.3% command: chrome pid: 3900266
11: cpu: 1.0% command: chrome pid: 3900302
13: cpu: 0.9% command: chrome pid: 3900235
14: cpu: 0.8% command: chrome pid: 3900233
15: cpu: 0.8% command: firefox pid: 3910735
17: cpu: 0.5% command: chrome-gnome-shell started by: python3 pid: 3910759
20: cpu: 0.2% command: chrome pid: 3900333
21: cpu: 0.2% command: chrome pid: 3900339
24: cpu: 0.1% command: chrome pid: 3900369
25: cpu: 0.1% command: chrome-gnome-shell started by: python3 pid: 3900463
26: cpu: 0.1% command: chrome-gnome-shell started by: python3 pid: 3900470
326: cpu: 0.0% command: chrome pid: 3900204
327: cpu: 0.0% command: chrome pid: 3900205
329: cpu: 0.0% command: chrome pid: 3900209
330: cpu: 0.0% command: chrome pid: 3900240
331: cpu: 0.0% command: chrome pid: 3900257
332: cpu: 0.0% command: chrome pid: 3900316
333: cpu: 0.0% command: chrome pid: 3900321
334: cpu: 0.0% command: chrome pid: 3900349
335: cpu: 0.0% command: chrome pid: 3900426
336: cpu: 0.0% command: chrome pid: 3900449
337: cpu: 0.0% command: chrome pid: 3900478
内存使用情况:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep -E "firefox|chrome"
1: mem: 330.1 MiB (1.3%) command: firefox pid: 3910531
2: mem: 230.6 MiB (0.9%) command: firefox pid: 3910586
3: mem: 222.3 MiB (0.9%) command: firefox pid: 3910656
4: mem: 198.4 MiB (0.8%) command: chrome pid: 3900194
5: mem: 149.2 MiB (0.6%) command: chrome pid: 3900233
6: mem: 137.7 MiB (0.5%) command: firefox pid: 3910707
7: mem: 124.8 MiB (0.5%) command: chrome pid: 3900266
9: mem: 111.6 MiB (0.4%) command: chrome pid: 3900302
10: mem: 94.5 MiB (0.3%) command: chrome pid: 3900339
11: mem: 94.3 MiB (0.3%) command: chrome pid: 3900333
12: mem: 86.3 MiB (0.3%) command: chrome pid: 3900369
13: mem: 85.5 MiB (0.3%) command: chrome pid: 3900449
14: mem: 83.9 MiB (0.3%) command: chrome pid: 3900321
15: mem: 83.7 MiB (0.3%) command: firefox pid: 3910735
18: mem: 80.2 MiB (0.3%) command: chrome pid: 3900316
19: mem: 79.5 MiB (0.3%) command: chrome pid: 3900235
21: mem: 75.6 MiB (0.3%) command: chrome pid: 3900349
30: mem: 56.0 MiB (0.2%) command: chrome pid: 3900478
33: mem: 53.4 MiB (0.2%) command: chrome pid: 3900204
34: mem: 52.9 MiB (0.2%) command: chrome pid: 3900205
35: mem: 51.0 MiB (0.2%) command: chrome pid: 3900426
52: mem: 34.9 MiB (0.1%) command: chrome-gnome-shell started by: python3
53: mem: 34.8 MiB (0.1%) command: chrome-gnome-shell started by: python3
54: mem: 34.5 MiB (0.1%) command: chrome-gnome-shell started by: python3
56: mem: 31.9 MiB (0.1%) command: chrome pid: 3900240
58: mem: 31.1 MiB (0.1%) command: chrome pid: 3900257
82: mem: 14.9 MiB (0.0%) command: chrome pid: 3900209
还要注意的是,您打开的每个选项卡也会使用更多的 RAM,但会占用很少的 CPU。
带有 1 个标签的 Firefox:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep firefox
1: mem: 394.1 MiB (1.6%) command: firefox pid: 3910531
2: mem: 351.5 MiB (1.4%) command: firefox pid: 3910586
3: mem: 175.7 MiB (0.7%) command: firefox pid: 3910656
4: mem: 137.3 MiB (0.5%) command: firefox pid: 3910707
6: mem: 83.9 MiB (0.3%) command: firefox pid: 3910735
带有 3 个选项卡的 Firefox:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep firefox
1: mem: 354.3 MiB (1.4%) command: firefox pid: 3910531
2: mem: 313.5 MiB (1.3%) command: firefox pid: 3910586
3: mem: 177.1 MiB (0.7%) command: firefox pid: 3910656
4: mem: 170.7 MiB (0.7%) command: firefox pid: 3910707
6: mem: 83.9 MiB (0.3%) command: firefox pid: 3910735
带有 5 个标签的 Firefox:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep firefox
1: mem: 358.6 MiB (1.4%) command: firefox pid: 3910531
2: mem: 313.2 MiB (1.3%) command: firefox pid: 3910586
3: mem: 177.7 MiB (0.7%) command: firefox pid: 3910656
4: mem: 177.7 MiB (0.7%) command: firefox pid: 3910707
6: mem: 83.9 MiB (0.3%) command: firefox pid: 3910735
Chrome 带有 1 个标签:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep chrome
3: mem: 201.3 MiB (0.8%) command: chrome pid: 4007777
6: mem: 145.7 MiB (0.6%) command: chrome pid: 4007815
7: mem: 122.3 MiB (0.5%) command: chrome pid: 4007853
9: mem: 111.1 MiB (0.4%) command: chrome pid: 4007889
10: mem: 92.7 MiB (0.3%) command: chrome pid: 4007920
11: mem: 91.8 MiB (0.3%) command: chrome pid: 4007923
12: mem: 85.4 MiB (0.3%) command: chrome pid: 4007981
13: mem: 85.0 MiB (0.3%) command: chrome pid: 4007962
15: mem: 82.5 MiB (0.3%) command: chrome pid: 4007916
18: mem: 79.2 MiB (0.3%) command: chrome pid: 4007903
20: mem: 76.2 MiB (0.3%) command: chrome pid: 4007817
21: mem: 74.5 MiB (0.3%) command: chrome pid: 4007925
30: mem: 56.2 MiB (0.2%) command: chrome pid: 4008026
33: mem: 53.6 MiB (0.2%) command: chrome pid: 4007786
34: mem: 53.5 MiB (0.2%) command: chrome pid: 4007787
35: mem: 51.9 MiB (0.2%) command: chrome pid: 4008005
52: mem: 34.8 MiB (0.1%) command: chrome-gnome-shell started by: python3
54: mem: 32.1 MiB (0.1%) command: chrome pid: 4007822
56: mem: 31.0 MiB (0.1%) command: chrome pid: 4007844
80: mem: 14.9 MiB (0.0%) command: chrome pid: 4007791
Chrome 有 3 个标签:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep chrome
3: mem: 205.7 MiB (0.8%) command: chrome pid: 4007777
6: mem: 156.8 MiB (0.6%) command: chrome pid: 4007815
7: mem: 126.5 MiB (0.5%) command: chrome pid: 4007853
8: mem: 115.2 MiB (0.4%) command: chrome pid: 4008005
10: mem: 110.9 MiB (0.4%) command: chrome pid: 4007889
11: mem: 100.4 MiB (0.4%) command: chrome pid: 4012062
12: mem: 92.7 MiB (0.3%) command: chrome pid: 4007923
13: mem: 92.5 MiB (0.3%) command: chrome pid: 4007920
14: mem: 85.2 MiB (0.3%) command: chrome pid: 4007962
16: mem: 82.5 MiB (0.3%) command: chrome pid: 4007916
19: mem: 79.2 MiB (0.3%) command: chrome pid: 4007903
20: mem: 76.7 MiB (0.3%) command: chrome pid: 4007817
22: mem: 74.6 MiB (0.3%) command: chrome pid: 4007925
31: mem: 56.3 MiB (0.2%) command: chrome pid: 4008026
34: mem: 53.6 MiB (0.2%) command: chrome pid: 4007786
35: mem: 53.5 MiB (0.2%) command: chrome pid: 4007787
36: mem: 51.0 MiB (0.2%) command: chrome pid: 4012075
53: mem: 34.8 MiB (0.1%) command: chrome-gnome-shell started by: python3
55: mem: 32.2 MiB (0.1%) command: chrome pid: 4007822
57: mem: 31.0 MiB (0.1%) command: chrome pid: 4007844
81: mem: 15.0 MiB (0.0%) command: chrome pid: 4007791
Chrome 有 5 个标签页:
terrance@terrance-ubuntu:~$ inxi -t m1000 | grep chrome
3: mem: 211.4 MiB (0.8%) command: chrome pid: 4007777
5: mem: 158.7 MiB (0.6%) command: chrome pid: 4007815
7: mem: 131.2 MiB (0.5%) command: chrome pid: 4007853
8: mem: 129.3 MiB (0.5%) command: chrome pid: 4008005
10: mem: 109.5 MiB (0.4%) command: chrome pid: 4007889
11: mem: 105.8 MiB (0.4%) command: chrome pid: 4012062
12: mem: 92.9 MiB (0.3%) command: chrome pid: 4007923
13: mem: 92.8 MiB (0.3%) command: chrome pid: 4007920
14: mem: 85.2 MiB (0.3%) command: chrome pid: 4007962
16: mem: 82.6 MiB (0.3%) command: chrome pid: 4007916
19: mem: 79.4 MiB (0.3%) command: chrome pid: 4007903
20: mem: 77.9 MiB (0.3%) command: chrome pid: 4007817
22: mem: 74.6 MiB (0.3%) command: chrome pid: 4007925
31: mem: 56.3 MiB (0.2%) command: chrome pid: 4008026
34: mem: 53.6 MiB (0.2%) command: chrome pid: 4007786
35: mem: 53.5 MiB (0.2%) command: chrome pid: 4007787
36: mem: 51.2 MiB (0.2%) command: chrome pid: 4012075
53: mem: 34.8 MiB (0.1%) command: chrome-gnome-shell started by: python3
55: mem: 32.2 MiB (0.1%) command: chrome pid: 4007822
57: mem: 31.0 MiB (0.1%) command: chrome pid: 4007844
81: mem: 15.0 MiB (0.0%) command: chrome pid: 4007791