亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux怎么查看線程

發布時間:2022-02-01 10:56:11 來源:億速云 閱讀:273 作者:小新 欄目:開發技術

這篇文章給大家分享的是有關Linux怎么查看線程的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

Linux系統的進程是由線程組成的,當然Linux進程下的線程數是不固定的,可以是一個進程,也可以是多個進程。

Linux怎么查看線程

pstree命令以樹狀圖顯示進程間的關系(display a tree of processes)。ps命令可以顯示當前正在運行的那些進程的信息,但是對于它們之間的關系卻顯示得不夠清晰。在Linux系統中,系統調用fork可以創建子進程,通過子shell也可以創建子進程,Linux系統中進程之間的關系天生就是一棵樹,樹的根就是進程PID為1的init進程。

1>.安裝pstree命令行工具,包名為:“psmisc”

 [root@yinzhengjie bin]# yum -y install psmisc
 Loaded plugins: fastestmirror
 Loading mirror speeds from cached hostfile
 Resolving Dependencies
 --> Running transaction check
 ---> Package psmisc.x86_64 0:22.20-15.el7 will be installed
 --> Finished Dependency Resolution
 
 Dependencies Resolved
 
 ====================================================================================================================================================================
  Package                               Arch                                  Version                                      Repository                           Size
 ====================================================================================================================================================================
 Installing:
  psmisc                                x86_64                                22.20-15.el7                                 base                                141 k
 
 Transaction Summary
 ====================================================================================================================================================================
 Install  1 Package
 
 Total download size: 141 k
 Installed size: 475 k
 Downloading packages:
 psmisc-22.20-15.el7.x86_64.rpm                                                                                                               | 141 kB  00:00:00    
 Running transaction check
 Running transaction test
 Transaction test succeeded
 Running transaction
   Installing : psmisc-22.20-15.el7.x86_64                                                                                                                       1/1
   Verifying  : psmisc-22.20-15.el7.x86_64                                                                                                                       1/1
 
 Installed:
   psmisc.x86_64 0:22.20-15.el7                                                                                                                                      
 
 Complete!
 [root@yinzhengjie bin]#

[root@yinzhengjie bin]# yum -y install psmisc

2>.相關參數介紹

 Usage: pstree [ -a ] [ -c ] [ -h | -H PID ] [ -l ] [ -n ] [ -p ] [ -g ] [ -u ]
               [ -A | -G | -U ] [ PID | USER ]
        pstree -V
 Display a tree of processes.
 
   -a, --arguments                       顯示命令時候,并顯示其參數的完整內容
 
   -A, --ascii                              各進程樹之間的連接以ASCII碼字符來連接
 
   -c, --compact                          取消同名兄弟進程的合并(默認會將同名的兄弟進程合并)
 
   -h, --highlight-all                    突出當前進程及其祖先
   -H PID,
 
   --highlight-pid=PID                   突出這個過程和它的祖先
 
   -g, --show-pgids                      顯示進程組ID;
 
   -G, --vt100                             使用VT100線繪制字符
 
   -l, --long                             不要截斷長線。
 
   -n, --numeric-sort                    用PID排序輸出
   -N type,
   --ns-sort=type                        sort by namespace type (ipc, mnt, net, pid, user, uts)
 
   -p, --show-pids                       同時列出每個進程的PID
 
   -s, --show-parents                    顯示選定過程的父母
 
   -S, --ns-changes                      顯示命名空間轉換
 •  -u, --uid-changes                     同時列出每個進程的所屬賬號名稱
 
   -U, --unicode                           各進程樹之間的連接以utf8字符來連接,某些終端可能會有錯誤
 
   -V, --version                           顯示版本信息
   -Z,
   --security-context                     顯示SELinux的安全上下文
 
   PID                                   從這個PID開始;默認值是1(init)。
 
   USER                                   只顯示在該用戶的進程中的樹

3>.案例1-顯示進程之間的關系

 [root@yinzhengjie bin]# pstree -apnh
 systemd,1 --switched-root --system --deserialize 22
   ├─systemd-journal,730
   ├─systemd-udevd,758
   ├─lvmetad,761 -f
   ├─auditd,1006
   │   └─{auditd},1007
   ├─irqbalance,1040 --foreground
   ├─systemd-logind,1041
   ├─polkitd,1043 --no-debug
   │   ├─{polkitd},1048
   │   ├─{polkitd},1051
   │   ├─{polkitd},1053
   │   ├─{polkitd},1054
   │   └─{polkitd},1055
   ├─dbus-daemon,1044 --system --address=systemd: --nofork --nopidfile --systemd-activation
   ├─NetworkManager,1046 --no-daemon
   │   ├─{NetworkManager},1072
   │   └─{NetworkManager},1074
   ├─crond,1047 -n
   ├─chronyd,1060
   ├─agetty,1065 --noclear tty1 linux
   ├─sshd,1400 -D
   │   ├─sshd,1985    
   │   │   └─bash,1987
   │   │       └─pstree,1660 -apnh
   │   └─sshd,2017
   │       └─bash,2019
   ├─tuned,1401 -Es /usr/sbin/tuned -l -P
   │   ├─{tuned},1706
   │   ├─{tuned},1707
   │   ├─{tuned},1708
   │   └─{tuned},1779
   ├─gmetad,1402 -d 1
   │   ├─{gmetad},1403
   │   ├─{gmetad},1404
   │   ├─{gmetad},1405
   │   ├─{gmetad},1406
   │   ├─{gmetad},1407
   │   ├─{gmetad},1408
   │   ├─{gmetad},1409
   │   └─{gmetad},1410
   ├─httpd,1411 -DFOREGROUND
   │   ├─httpd,1757 -DFOREGROUND
   │   ├─httpd,1758 -DFOREGROUND
   │   ├─httpd,1759 -DFOREGROUND
   │   ├─httpd,1760 -DFOREGROUND
   │   └─httpd,1761 -DFOREGROUND
   ├─rsyslogd,1414 -n
   │   ├─{rsyslogd},1421
   │   └─{rsyslogd},1427
   ├─zabbix_agentd,1418 -c /etc/zabbix/zabbix_agentd.conf
   │   ├─zabbix_agentd,1420          
   │   ├─zabbix_agentd,1422
   │   ├─zabbix_agentd,1423
   │   ├─zabbix_agentd,1424
   │   └─zabbix_agentd,1425  
   ├─gmond,1851
   │   └─{gmond},1855
   └─java,2484 -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/soft/zk/bin/../build/classes:/soft/zk/bin/../build/lib/*.jar:/soft/zk/bin/../lib/
       ├─{java},2487
       ├─{java},2488
       ├─{java},2489
       ├─{java},2490
       ├─{java},2491
       ├─{java},2492
       ├─{java},2493
       ├─{java},2494
       ├─{java},2495
       ├─{java},2496
       ├─{java},2497
       ├─{java},2498
       ├─{java},2499
       ├─{java},2500
       ├─{java},2501
       ├─{java},2502
       ├─{java},2503
       ├─{java},2504
       ├─{java},2505
       ├─{java},2506
       ├─{java},2507
       ├─{java},2508
       ├─{java},2509
       ├─{java},2510
       ├─{java},2511
       ├─{java},2512
       ├─{java},2513
       ├─{java},2514
       ├─{java},2515
       ├─{java},2516
       ├─{java},2517
       ├─{java},2518
       ├─{java},2519
       ├─{java},2520
       ├─{java},2521
       ├─{java},2522
       ├─{java},2523
       ├─{java},2524
       ├─{java},2525
       ├─{java},2526
       ├─{java},2527
       ├─{java},2528
       ├─{java},2529
       ├─{java},2530
       ├─{java},2531
       ├─{java},2532
       ├─{java},2534
       ├─{java},2535
       ├─{java},2536
       ├─{java},2537
       ├─{java},2538
       ├─{java},2539
       ├─{java},2540
       ├─{java},2541
       ├─{java},2542
       ├─{java},2543
       ├─{java},2544
       ├─{java},2545
       ├─{java},2546
       ├─{java},2547
       ├─{java},2548
       └─{java},2549
 [root@yinzhengjie bin]#

[root@yinzhengjie bin]# pstree -apnh

4>.案例2-以樹狀圖顯示進程,還顯示進程PID

 [root@yinzhengjie bin]# pstree -p
 systemd(1)─┬─NetworkManager(1046)─┬─{NetworkManager}(1072)
            │                      └─{NetworkManager}(1074)
            ├─agetty(1065)
            ├─auditd(1006)───{auditd}(1007)
            ├─chronyd(1060)
            ├─crond(1047)
            ├─dbus-daemon(1044)
            ├─gmetad(1402)─┬─{gmetad}(1403)
            │              ├─{gmetad}(1404)
            │              ├─{gmetad}(1405)
            │              ├─{gmetad}(1406)
            │              ├─{gmetad}(1407)
            │              ├─{gmetad}(1408)
            │              ├─{gmetad}(1409)
            │              └─{gmetad}(1410)
            ├─gmond(1851)───{gmond}(1855)
            ├─httpd(1411)─┬─httpd(1757)
            │             ├─httpd(1758)
            │             ├─httpd(1759)
            │             ├─httpd(1760)
            │             └─httpd(1761)
            ├─irqbalance(1040)
            ├─java(2484)─┬─{java}(2487)
            │            ├─{java}(2488)
            │            ├─{java}(2489)
            │            ├─{java}(2490)
            │            ├─{java}(2491)
            │            ├─{java}(2492)
            │            ├─{java}(2493)
            │            ├─{java}(2494)
            │            ├─{java}(2495)
            │            ├─{java}(2496)
            │            ├─{java}(2497)
            │            ├─{java}(2498)
            │            ├─{java}(2499)
            │            ├─{java}(2500)
            │            ├─{java}(2501)
            │            ├─{java}(2502)
            │            ├─{java}(2503)
            │            ├─{java}(2504)
            │            ├─{java}(2505)
            │            ├─{java}(2506)
            │            ├─{java}(2507)
            │            ├─{java}(2508)
            │            ├─{java}(2509)
            │            ├─{java}(2510)
            │            ├─{java}(2511)
            │            ├─{java}(2512)
            │            ├─{java}(2513)
            │            ├─{java}(2514)
            │            ├─{java}(2515)
            │            ├─{java}(2516)
            │            ├─{java}(2517)
            │            ├─{java}(2518)
            │            ├─{java}(2519)
            │            ├─{java}(2520)
            │            ├─{java}(2521)
            │            ├─{java}(2522)
            │            ├─{java}(2523)
            │            ├─{java}(2524)
            │            ├─{java}(2525)
            │            ├─{java}(2526)
            │            ├─{java}(2527)
            │            ├─{java}(2528)
            │            ├─{java}(2529)
            │            ├─{java}(2530)
            │            ├─{java}(2531)
            │            ├─{java}(2532)
            │            ├─{java}(2534)
            │            ├─{java}(2535)
            │            ├─{java}(2536)
            │            ├─{java}(2537)
            │            ├─{java}(2538)
            │            ├─{java}(2539)
            │            ├─{java}(2540)
            │            ├─{java}(2541)
            │            ├─{java}(2542)
            │            ├─{java}(2543)
            │            ├─{java}(2544)
            │            ├─{java}(2545)
            │            ├─{java}(2546)
            │            ├─{java}(2547)
            │            ├─{java}(2548)
            │            └─{java}(2549)
            ├─lvmetad(761)
            ├─polkitd(1043)─┬─{polkitd}(1048)
            │               ├─{polkitd}(1051)
            │               ├─{polkitd}(1053)
            │               ├─{polkitd}(1054)
            │               └─{polkitd}(1055)
            ├─rsyslogd(1414)─┬─{rsyslogd}(1421)
            │                └─{rsyslogd}(1427)
            ├─sshd(1400)─┬─sshd(1985)───bash(1987)───pstree(2403)
            │            └─sshd(2017)───bash(2019)
            ├─systemd-journal(730)
            ├─systemd-logind(1041)
            ├─systemd-udevd(758)
            ├─tuned(1401)─┬─{tuned}(1706)
            │             ├─{tuned}(1707)
            │             ├─{tuned}(1708)
            │             └─{tuned}(1779)
            └─zabbix_agentd(1418)─┬─zabbix_agentd(1420)
                                  ├─zabbix_agentd(1422)
                                  ├─zabbix_agentd(1423)
                                  ├─zabbix_agentd(1424)
                                  └─zabbix_agentd(1425)
 [root@yinzhengjie bin]#

[root@yinzhengjie bin]# pstree -p

5>.案例3-*顯示命令和其完整參數*

 [root@yinzhengjie bin]# pstree -a
 systemd --switched-root --system --deserialize 22
   ├─NetworkManager --no-daemon
   │   └─2*[{NetworkManager}]
   ├─agetty --noclear tty1 linux
   ├─auditd
   │   └─{auditd}
   ├─chronyd
   ├─crond -n
   ├─dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
   ├─gmetad -d 1
   │   └─8*[{gmetad}]
   ├─gmond
   │   └─{gmond}
   ├─httpd -DFOREGROUND
   │   ├─httpd -DFOREGROUND
   │   ├─httpd -DFOREGROUND
   │   ├─httpd -DFOREGROUND
   │   ├─httpd -DFOREGROUND
   │   └─httpd -DFOREGROUND
   ├─irqbalance --foreground
   ├─java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp/soft/zk/bin/../build/classes:/soft/zk/bin/../build/lib/*.jar:/soft/zk/bin/../lib/
   │   └─62*[{java}]
   ├─lvmetad -f
   ├─polkitd --no-debug
   │   └─5*[{polkitd}]
   ├─rsyslogd -n
   │   └─2*[{rsyslogd}]
   ├─sshd -D
   │   ├─sshd    
   │   │   └─bash
   │   │       └─pstree -a
   │   └─sshd
   │       └─bash
   ├─systemd-journal
   ├─systemd-logind
   ├─systemd-udevd
   ├─tuned -Es /usr/sbin/tuned -l -P
   │   └─4*[{tuned}]
   └─zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
       ├─zabbix_agentd          
       ├─zabbix_agentd
       ├─zabbix_agentd
       ├─zabbix_agentd
       └─zabbix_agentd  
 [root@yinzhengjie bin]#

[root@yinzhengjie bin]# pstree -a

6>.案例4-取消合并,默認會將同名的兄弟進程合并,-c取消合并,分開顯示

 [root@yinzhengjie bin]# pstree -c
 systemd─┬─NetworkManager─┬─{NetworkManager}
         │                └─{NetworkManager}
         ├─agetty
         ├─auditd───{auditd}
         ├─chronyd
         ├─crond
         ├─dbus-daemon
         ├─gmetad─┬─{gmetad}
         │        ├─{gmetad}
         │        ├─{gmetad}
         │        ├─{gmetad}
         │        ├─{gmetad}
         │        ├─{gmetad}
         │        ├─{gmetad}
         │        └─{gmetad}
         ├─gmond───{gmond}
         ├─httpd─┬─httpd
         │       ├─httpd
         │       ├─httpd
         │       ├─httpd
         │       └─httpd
         ├─irqbalance
         ├─java─┬─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      ├─{java}
         │      └─{java}
         ├─lvmetad
         ├─polkitd─┬─{polkitd}
         │         ├─{polkitd}
         │         ├─{polkitd}
         │         ├─{polkitd}
         │         └─{polkitd}
         ├─rsyslogd─┬─{rsyslogd}
         │          └─{rsyslogd}
         ├─sshd─┬─sshd───bash───pstree
         │      └─sshd───bash
         ├─systemd-journal
         ├─systemd-logind
         ├─systemd-udevd
         ├─tuned─┬─{tuned}
         │       ├─{tuned}
         │       ├─{tuned}
         │       └─{tuned}
         └─zabbix_agentd─┬─zabbix_agentd
                         ├─zabbix_agentd
                         ├─zabbix_agentd
                         ├─zabbix_agentd
                         └─zabbix_agentd
 [root@yinzhengjie bin]#

[root@yinzhengjie bin]# pstree -c

7>.案例5-查詢zookeeper進程打開的線程數

 [root@yinzhengjie bin]# jps
 2484 QuorumPeerMain
 5127 Jps
 [root@yinzhengjie bin]#
 [root@yinzhengjie bin]#
 [root@yinzhengjie bin]# pstree -p `jps | grep QuorumPeerMain | awk '{print $1}'` | wc -l
 62
 [root@yinzhengjie bin]#
 [root@yinzhengjie bin]#
 [root@yinzhengjie bin]# pstree -p 2484 | wc -l
 62
 [root@yinzhengjie bin]#

總結:

  通過pstree清晰的看到進程的父子關系,但是進程狀態查看,還是需要ps、top等命令。pstree命令是用于查看進程樹之間的關系,即哪個進程是父進程,哪個是子進程,可以清楚的看出來是誰創建了誰。

  推薦學習的博客:http://www.runoob.com/linux/linux-command-manual.html

二.使用top命令查看

1>.使用pstree命令查看”ResourceManager”進程打開的線程數

 [root@yinzhengjie ~]# jps
 6178 Jps
 10339 ResourceManager
 10309 JobTracker
 9462 NameNode
 9464 Bootstrap
 9466 DFSZKFailoverController
 11052 HistoryServer
 11054 HistoryServer
 10367 JobHistoryServer
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]# pstree -p 10339 | wc -l
 248
 [root@yinzhengjie ~]#

2>.使用top命令查看“ResourceManager”打開的進程數

 [root@yinzhengjie ~]# top -H -p 10339
 top - 01:38:45 up 7 days,  1:33,  3 users,  load average: 0.02, 0.06, 0.05
 Threads: 247 total,   0 running, 247 sleeping,   0 stopped,   0 zombie
 %Cpu(s):  0.1 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
 KiB Mem : 18328176 total, 11610648 free,  5253524 used,  1464004 buff/cache
 KiB Swap:  9306108 total,  9306108 free,        0 used. 12658008 avail Mem
 
   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                        
 10791 yarn      20   0 3131380 622256  23808 S  0.3  3.4   0:15.83 java                                                                                            
 10339 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.25 java                                                                                            
 10608 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:03.12 java                                                                                            
 10609 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.65 java                                                                                            
 10610 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.65 java                                                                                            
 10611 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.69 java                                                                                            
 10612 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.66 java                                                                                            
 10613 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.70 java                                                                                            
 10614 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.69 java                                                                                            
 10615 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.67 java                                                                                            
 10616 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.68 java                                                                                            
 10617 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.68 java                                                                                            
 10618 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.67 java                                                                                            
 10619 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.70 java                                                                                            
 10620 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.68 java                                                                                            
 10621 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.66 java                                                                                            
 10622 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.67 java                                                                                            
 10623 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:01.69 java                                                                                            
 10624 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10625 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10626 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10627 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10628 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:15.73 java                                                                                            
 10645 yarn      20   0 3131380 622256  23808 S  0.0  3.4   1:59.54 java                                                                                            
 10651 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.06 java                                                                                            
 10652 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.04 java                                                                                            
 10656 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10657 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:00.00 java                                                                                            
 10658 yarn      20   0 3131380 622256  23808 S  0.0  3.4   0:08.24 java                                                                                            
 [root@yinzhengjie ~]#

[root@yinzhengjie ~]# top -H -p 10339

Linux怎么查看線程

三.直接去“/proc”對應PID的status目錄查看

由于在Linux操作系統中,正在運行的程序都會在/proc這個目錄下存放運行時文件的狀態信息,因此我們在這個目錄下,找到對應的進程ID就可以查看到該進程打開的線程數。當然還有一些其他的詳細信息都在這個目錄下存放著。

 [root@yinzhengjie ~]# cat /proc/10339/status
 Name:   java
 Umask:  0022
 State:  S (sleeping)
 Tgid:   10339
 Ngid:   0
 Pid:    10339
 PPid:   8410
 TracerPid:      0
 Uid:    988     988     988     988
 Gid:    985     985     985     985
 FDSize: 512
 Groups: 985 994
 VmPeak:  3131384 kB
 VmSize:  3131380 kB
 VmLck:         0 kB
 VmPin:         0 kB
 VmHWM:    622300 kB
 VmRSS:    622256 kB
 RssAnon:          598448 kB
 RssFile:           23808 kB
 RssShmem:              0 kB
 VmData:  2962116 kB
 VmStk:       144 kB
 VmExe:         4 kB
 VmLib:     17152 kB
 VmPTE:      1808 kB
 VmSwap:        0 kB
 Threads:        248
 SigQ:   0/71498
 SigPnd: 0000000000000000
 ShdPnd: 0000000000000000
 SigBlk: 0000000000000000
 SigIgn: 0000000000000000
 SigCgt: 2000000181005ccf
 CapInh: 0000000000000000
 CapPrm: 0000000000000000
 CapEff: 0000000000000000
 CapBnd: 0000001fffffffff
 CapAmb: 0000000000000000
 Seccomp:        0
 Cpus_allowed:   fffff
 Cpus_allowed_list:      0-19
 Mems_allowed:   00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003
 Mems_allowed_list:      0-1
 voluntary_ctxt_switches:        67
 nonvoluntary_ctxt_switches:     19
 [root@yinzhengjie ~]#

[root@yinzhengjie ~]# cat /proc/10339/status

Linux怎么查看線程

四.*直接去“/proc”對應PID的task目錄查看*

 [root@yinzhengjie ~]# jps
 8704 Jps
 10339 ResourceManager
 10309 JobTracker
 9462 NameNode
 9464 Bootstrap
 9466 DFSZKFailoverController
 11052 HistoryServer
 11054 HistoryServer
 10367 JobHistoryServer
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]# pstree -p 10339 | wc -l    
 248
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]# ll /proc/10339/task/ | wc -l    
 248
 [root@yinzhengjie ~]#
 [root@yinzhengjie ~]#

感謝各位的閱讀!關于“Linux怎么查看線程”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

英山县| 巩留县| 汪清县| 五莲县| 房山区| 大石桥市| 上思县| 犍为县| 张家界市| 海宁市| 抚州市| 绥芬河市| 离岛区| 扎囊县| 英吉沙县| 清镇市| 玉山县| 瓦房店市| 南部县| 陇南市| 乌拉特后旗| 泰和县| 临潭县| 林周县| 福海县| 托里县| 闻喜县| 漳浦县| 衢州市| 陈巴尔虎旗| 赤壁市| 乌海市| 达拉特旗| 宝清县| 重庆市| 子洲县| 云阳县| 晋江市| 车致| 三都| 隆安县|