Debian Codegraph @

upstream/debian-unstable/man5/proc_pid_task.5

raw
1 .\" Copyright 1994-1995, Daniel Quinlan <[email protected]>
2 .\" Copyright 2002-2017, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_pid_task 5 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 /proc/pid/task/, /proc/tid/, /proc/thread\-self/ \- thread information
10 .SH DESCRIPTION
11 .TP
12 .IR /proc/ pid /task/ " (since Linux 2.6.0)"
13 .\" Precisely: Linux 2.6.0-test6
14 This is a directory that contains one subdirectory
15 for each thread in the process.
16 The name of each subdirectory is the numerical thread ID
17 .RI ( tid )
18 of the thread (see
19 .BR gettid (2)).
20 .IP
21 Within each of these subdirectories, there is a set of
22 files with the same names and contents as under the
23 .IR /proc/ pid
24 directories.
25 For attributes that are shared by all threads, the contents for
26 each of the files under the
27 .IR task/ tid
28 subdirectories will be the same as in the corresponding
29 file in the parent
30 .IR /proc/ pid
31 directory
32 (e.g., in a multithreaded process, all of the
33 .IR task/ tid /cwd
34 files will have the same value as the
35 .IR /proc/ pid /cwd
36 file in the parent directory, since all of the threads in a process
37 share a working directory).
38 For attributes that are distinct for each thread,
39 the corresponding files under
40 .IR task/ tid
41 may have different values (e.g., various fields in each of the
42 .IR task/ tid /status
43 files may be different for each thread),
44 .\" in particular: "children" :/
45 or they might not exist in
46 .IR /proc/ pid
47 at all.
48 .IP
49 .\" The following was still true as at kernel 2.6.13
50 In a multithreaded process, the contents of the
51 .IR /proc/ pid /task
52 directory are not available if the main thread has already terminated
53 (typically by calling
54 .BR pthread_exit (3)).
55 .IP
56 See also:
57 .RS
58 .TP
59 .BR proc_tid_children (5).
60 .RE
61 .TP
62 .IR /proc/ tid /
63 There is a numerical subdirectory for each running thread
64 that is not a thread group leader
65 (i.e., a thread whose thread ID is not the same as its process ID);
66 the subdirectory is named by the thread ID.
67 Each one of these subdirectories contains files and subdirectories
68 exposing information about the thread with the thread ID
69 .IR tid .
70 The contents of these directories are the same as the corresponding
71 .IR /proc/ pid /task/ tid
72 directories.
73 .IP
74 The
75 .IR /proc/ tid
76 subdirectories are
77 .I not
78 visible when iterating through
79 .I /proc
80 with
81 .BR getdents (2)
82 (and thus are
83 .I not
84 visible when one uses
85 .BR ls (1)
86 to view the contents of
87 .IR /proc ).
88 However, the pathnames of these directories are visible to
89 (i.e., usable as arguments in)
90 system calls that operate on pathnames.
91 .TP
92 .IR /proc/thread\-self/ " (since Linux 3.17)"
93 .\" commit 0097875bd41528922fb3bb5f348c53f17e00e2fd
94 This directory refers to the thread accessing the
95 .I /proc
96 filesystem,
97 and is identical to the
98 .IR /proc/self/task/ tid
99 directory named by the process thread ID
100 .RI ( tid )
101 of the same thread.
102 .SH SEE ALSO
103 .BR proc (5)