.\" Copyright (C) 1994, 1995, Daniel Quinlan .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk .\" Copyright (C) 2023, Alejandro Colomar .\" .\" SPDX-License-Identifier: GPL-3.0-or-later .\" .TH proc_pid_task 5 2023-08-15 "Linux man-pages 6.7" .SH NAME /proc/pid/task/, /proc/tid/, /proc/thread\-self/ \- thread information .SH DESCRIPTION .TP .IR /proc/ pid /task/ " (since Linux 2.6.0)" .\" Precisely: Linux 2.6.0-test6 This is a directory that contains one subdirectory for each thread in the process. The name of each subdirectory is the numerical thread ID .RI ( tid ) of the thread (see .BR gettid (2)). .IP Within each of these subdirectories, there is a set of files with the same names and contents as under the .IR /proc/ pid directories. For attributes that are shared by all threads, the contents for each of the files under the .IR task/ tid subdirectories will be the same as in the corresponding file in the parent .IR /proc/ pid directory (e.g., in a multithreaded process, all of the .IR task/ tid /cwd files will have the same value as the .IR /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 under .IR task/ tid may have different values (e.g., various fields in each of the .IR task/ tid /status files may be different for each thread), .\" in particular: "children" :/ or they might not exist in .IR /proc/ pid at all. .IP .\" The following was still true as at kernel 2.6.13 In a multithreaded process, the contents of the .IR /proc/ pid /task directory are not available if the main thread has already terminated (typically by calling .BR pthread_exit (3)). .TP .IR /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 ID .IR tid . The contents of these directories are the same as the corresponding .IR /proc/ pid /task/ tid directories. .IP The .IR /proc/ tid subdirectories are .I not visible when iterating through .I /proc with .BR getdents (2) (and thus are .I not visible when one uses .BR ls (1) to view the contents of .IR /proc ). However, the pathnames of these directories are visible to (i.e., usable as arguments in) system calls that operate on pathnames. .TP .IR /proc/thread\-self/ " (since Linux 3.17)" .\" commit 0097875bd41528922fb3bb5f348c53f17e00e2fd This directory refers to the thread accessing the .I /proc filesystem, and is identical to the .IR /proc/self/task/ tid directory named by the process thread ID .RI ( tid ) of the same thread. .SH SEE ALSO .BR proc (5)