proc_pid_task(5) File Formats Manualproc_pid_task(5)/proc/pid/task/, /proc/tid/, /proc/thread-self/ - thread information
/proc/pid/task/ (since Linux 2.6.0) This is a directory that contains one subdirectory for each thread in the process. The name of each subdirectory is the numerical thread ID (tid) of the thread (seegettid(2)). Within each of these subdirectories, there is a set of files with the same names and contents as under the/proc/pid directories. For attributes that are shared by all threads, the contents for each of the files under thetask/tid subdirectories will be the same as in the corresponding file in the parent/proc/pid directory (e.g., in a multithreaded process, all of thetask/tid/cwd files will have the same value as the/proc/pid/cwd file in the parent directory, since all of the threads in a process share a working directory). For attributes that are distinct for each thread, the corresponding files undertask/tid may have different values (e.g., various fields in each of thetask/tid/status files may be different for each thread), or they might not exist in/proc/pid at all. In a multithreaded process, the contents of the/proc/pid/task directory are not available if the main thread has already terminated (typically by callingpthread_exit(3))./proc/tid/ There is a numerical subdirectory for each running thread that is not a thread group leader (i.e., a thread whose thread ID is not the same as its process ID); the subdirectory is named by the thread ID. Each one of these subdirectories contains files and subdirectories exposing information about the thread with the thread IDtid. The contents of these directories are the same as the corresponding/proc/pid/task/tid directories. The/proc/tid subdirectories arenot visible when iterating through/proc withgetdents(2) (and thus arenot visible when one usesls(1) to view the contents of/proc). However, the pathnames of these directories are visible to (i.e., usable as arguments in) system calls that operate on pathnames./proc/thread-self/ (since Linux 3.17) This directory refers to the thread accessing the/proc filesystem, and is identical to the/proc/self/task/tid directory named by the process thread ID (tid) of the same thread.
proc(5)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-05-17proc_pid_task(5)HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |