Multi-threaded viewing tool under Linux (Pstree, PS, Pstack)

Source: Internet
Author: User

1. Pstree

Pstree displaying processes in a tree structure
$ pstree-p Work | grep ad
SSHD (22669)---bash (22670)---ad_preprocess (4551)-+-{ad_preprocess} (4552)
|-{ad_preprocess} (4553)
|-{ad_preprocess} (4554)
|-{ad_preprocess} (4555)
|-{ad_preprocess} (4556)
'-{ad_preprocess} (4557)

Work for the working user,-p for the display process identification number, ad_preprocess a total of 6 sub-threads, plus the main thread total of 7 threads

2. Ps-lf

$ ps-lf4551
UID PID PPID LWP C nlwp stime TTY STAT time CMD
Work 4551 22670 4551 2 7 16:30 pts/2 sl+ 0:02./ad_preprocess
Work 4551 22670 4552 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess
Work 4551 22670 4553 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess
Work 4551 22670 4554 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess
Work 4551 22670 4555 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess
Work 4551 22670 4556 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess
Work 4551 22670 4557 0 7 16:30 pts/2 sl+ 0:00./ad_preprocess

The process has started a total of 7 threads

3. Pstack

Pstack show stack traces for each process

$ pstack4551
Thread 7 (thread 1084229984 (LWP 4552)):
#0 0x000000302afc63dc in epoll_wait () from/lib64/tls/libc.so.6
#1 0x00000000006f0730 in Ub::epollex::p oll ()
#2 0x00000000006f172a in Ub::netreactor::callback ()
#3 0x00000000006fbbbb in Ub::ubtask::callback ()
#4 0x000000302b80610a in Start_thread () from/lib64/tls/libpthread.so.0
#5 0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#6 0x0000000000000000 in?? ()
Thread 6 (thread 1094719840 (LWP 4553)):
#0 0x000000302afc63dc in epoll_wait () from/lib64/tls/libc.so.6
#1 0x00000000006f0730 in Ub::epollex::p oll ()
#2 0x00000000006f172a in Ub::netreactor::callback ()
#3 0x00000000006fbbbb in Ub::ubtask::callback ()
#4 0x000000302b80610a in Start_thread () from/lib64/tls/libpthread.so.0
#5 0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#6 0x0000000000000000 in?? ()
Thread 5 (thread 1105209696 (LWP 4554)):
#0 0x000000302b80baa5 in __nanosleep_nocancel ()
#1 0x000000000079e758 in Comcm::ms_sleep ()
#2 0x00000000006c8581 in Ub::ubclientmanager::healthycheck ()
#3 0x00000000006c8471 in Ub::ubclientmanager::start_healthy_check ()
#4 0x000000302b80610a in Start_thread () from/lib64/tls/libpthread.so.0
#5 0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#6 0x0000000000000000 in?? ()
Thread 4 (thread 1115699552 (LWP 4555)):
#0 0x000000302b80baa5 in __nanosleep_nocancel ()
#1 0x0000000000482b0e in Armor::armor_check_thread ()
#2 0x000000302b80610a in Start_thread () from/lib64/tls/libpthread.so.0
#3 0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#4 0x0000000000000000 in?? ()
Thread 3 (thread 1126189408 (LWP 4556)):
#0 0x000000302af8f1a5 in __nanosleep_nocancel () from/lib64/tls/libc.so.6
#1 0x000000302af8f010 in Sleep () from/lib64/tls/libc.so.6
#2 0x000000000044c972 in Business_config_manager::run ()
#3 0x0000000000457b83 in Thread::run_thread ()
#4 0x000000302b80610a in Start_thread () from/lib64/tls/libpthread.so.0
#5 0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#6 0x0000000000000000 in?? ()
thread 2 (Thread 1136679264 (LWP 4557):
#0   0X000000302AF8F1A5 in __nanosleep_ Nocancel () from/lib64/tls/libc.so.6
#1   0x000000302af8f010 in sleep () from/lib64/tls/libc.so.6
#2   0X00000000004524BB in Process_thread::sleep_period ()
#3   0x0000000000452641 in Process_thread::run ()
#4 & nbsp 0x0000000000457b83 in Thread::run_thread ()
#5   0x000000302b80610a in Start_thread () from/lib64/tls/ libpthread.so.0
#6   0x000000302afc6003 in Clone () from/lib64/tls/libc.so.6
#7   0x0000000000000000 in ?? ()
thread 1 (Thread 182894129792 (LWP 4551)):
#0   0X000000302AF8F1A5 in __ Nanosleep_nocancel () from/lib64/tls/libc.so.6
#1   0x000000302af8f010 in sleep () from/lib64/tls/libc.so.6
#2   0x0000000000420d79 in Ad_preprocess::run ()
#3   0x0000000000450ad0 in Main ()

http://blog.csdn.net/yfkiss/article/details/6729364

Linux under Multi-threaded view tool (Pstree, PS, Pstack) (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.