summaryrefslogtreecommitdiffstats
path: root/man5/proc_pid_task.5
blob: 70af355a3480c88e9d72eeed50c1862fcbaa7ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
.\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
.\"
.\" 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)