How to specify threads open for every application on Linux?

Is there a way to find out, in real time, which streams are open and which application has opened them?

+5
source share
3 answers

You can see /proc/<PID>/task/(where <PID>is the process identifier), which will contain several subdirectories, each of which has a name equal to the thread identifier of one of the threads in this task.

Please note that this is only real-time sorting, but if you do not want to “freeze” the entire system for a while, the information you receive can always be outdated, since the process can create or destroy threads, even if you look at the data .

+9

Linuxes . LWP ( " " ), PID. , " " ( ) PID, PID , ( LWP). , , LWP PID.

ps -L, ereOn . , ps . , .

LWP (-o lwp=) PID (-o pid=) (-A) (-L) . , - , :

$ ps -A -L -o lwp= -o pid=
...
27747 27747
27749 27749
27750 27750
27751 27750
27752 27750
27755 27750
27756 27750
27772 27772
27858 27858
30457 30457
30886 30886

C ++, ? , popen ++.

, ps , /proc. , /proc. ps - POSIX *, ; /proc Linux, . , ps , , /proc, .


* , POSIX -L. Linux, GNU toolchain, .

+4

, ps -L .

ps .

, , , , ps , , , .

+3
source

All Articles