thank me later

The /proc filesystem

Underneath /proc, there are the following general groups of files and subdirectories.

The /proc/<pid> subdirectories

Each one of these subdirectories contains files and subdirectories exposing information about the process with the corresponding <pid>.

Underneath each of the /proc/<pid> directories, a task subdirectory contains subdirectories of the form task/<tid>, where <tid> is the kernel thread ID of the thread.

The /proc/pid subdirectories are visible when iterating through /proc with getdents (thus visible with ls).

The /proc/<tid> subdirectories

Each one of these subdirectories contains files and subdirectories exposing information about the thread with the corresponding thread ID.

The contents of these directories are the same as the corresponding /proc/<pid>/task/<tid> directories.

The /proc/tid subdirectories are not visible when iterating through /proc with getdents (thus not visible with ls).

The /proc/self directory

When a process accesses this magic symbolic link, it resolves to the process's own /proc/<pid> directory.

The /proc/thread-self dorectory

When a thread accesses this magic symbolic link, it resolves to the process's own /proc/self/task/<tid> directory.