Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Linux keeps track of execution with kernel task records, groups related tasks into processes, and exposes selected information through /proc. The scheduler separately decides which runnable tasks get CPU time. “Thousands” is a possible count on a particular machine, not a universal number: the total depends on that system and its workload.

What Linux tracks: tasks, processes, and threads

The kernel represents each schedulable unit of execution as a task. In kernel accounting terminology, a task is represented by a task_struct. A process, in the familiar Unix sense, is a thread group: it can contain several tasks, commonly called threads, that share an address space.

This distinction matters because a multithreaded program is not a single indivisible execution record. Its threads are individual tasks, grouped together as one process. The kernel documentation describes process-level statistics as an aggregation across the thread group. Linux kernel documentation: Per-task statistics interface

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How PIDs identify tasks in different views

A process identifier (PID) is meaningful within a PID namespace. A host and a container can therefore display different PIDs for the same task: each view reflects its own namespace. A PID is a practical handle for locating a process in a particular view, not a number that every observer is guaranteed to see identically.

Linux exposes namespace-related identifiers, including NSpid and NStgid, in process status information. The procfs documentation also describes how PID translation works for a procfs instance. Linux kernel documentation: The /proc Filesystem

Where process information appears: /proc

The Linux Kernel documentation describes procfs as “an interface to internal data structures in the kernel.” It is a kernel-provided view, not a separate process database that users have to keep synchronized. Each visible process has a PID-named directory, such as /proc/1234, containing selected information.

  • status and stat expose process state and related details.
  • cmdline provides command-line arguments.
  • fd lists the process’s file descriptors.
  • maps reports its memory mappings.

For example, inspect a process status file with cat /proc/1234/status, replacing 1234 with the PID visible to you. Utilities such as ps gather information from procfs to build their displays.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you can see depends on your permissions and the procfs instance’s visibility rules. Namespace boundaries affect which processes appear, and procfs mount options such as hidepid can restrict access to information about other users’ processes.

Tracking is not the same as running

The kernel can track a process while it is sleeping or waiting; that does not mean it is continuously executing on a CPU. The scheduler chooses among runnable tasks and allocates CPU time. Kernel scheduler documentation uses CFS’s run-queue and virtual-runtime design as an explanation of that role, while noting a transition toward EEVDF. The example illustrates the separation between keeping records and scheduling; it should not be read as a promise that every current kernel uses the older CFS mechanism unchanged. Linux kernel documentation: CFS Scheduler

Accounting and resource groups serve different purposes

PID-based identification is only one part of process management. Linux provides separate mechanisms for collecting statistics and grouping processes for resource management.

Mechanism What it represents or does How it is used
PID and PID namespace Identifies a task in a particular namespace view. Locating a process, including through a PID-named procfs directory.
/proc A kernel-provided interface exposing selected process information. Inspection by people and tools such as ps.
Taskstats Statistics for an individual task or a process; process-level values can aggregate a thread group. Accounting through a netlink interface, including statistics during a task’s lifetime and data on exit.
Cgroups Groups processes for resource management. Applying and examining resource controls; a cgroup namespace can change paths visible in /proc/PID/cgroup.

Taskstats is an accounting interface, not the same thing as a PID lookup. Its documentation identifies the interface description as version 5.3.0 and says the current taskstats.h definition takes precedence as the interface evolves. Linux kernel documentation: Per-task statistics interface Cgroups, by contrast, group processes for resource management; namespace-specific views can affect the paths shown in /proc/PID/cgroup. Linux kernel documentation: Control Group v2

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why there is no universal count of Linux processes

The number of processes and threads belongs to a particular running system, not to Linux as a whole. It changes with workload, and the count can differ depending on whether someone means processes, individual threads, or entries visible from a particular namespace. The kernel documentation cited here does not establish a universal total, so “thousands” is framing rather than a sourced system-wide statistic.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.