# What is a process?

> A process is a running program with its own PID, memory space, and credentials the kernel tracks.

Source: https://fullbytedeveloper.com/blog/what-is-a-process
Published here: 2026-12-03, updated 2026-12-03

A process is a running program the kernel tracks with its own process ID, memory space, and credentials [1][2]. One executable file on disk can become many processes if you start it many times; each instance gets its own PID and address space. Pair with [what is a container](/blog/what-is-a-container) when namespaces wrap those processes.

## Print your shell PID in under a minute

```bash
echo "my shell pid=$$ ppid=$PPID comm=$(ps -p $$ -o comm=)"
```

Captured on this host:

```text
my shell pid=42959 ppid=343 comm=bash
```

You get a numeric PID, a PPID one step up the tree, and a command name. That pair is how job control and `kill` name targets [2]. Absolute numbers change every run.

## Prove fork isolation with a tiny C program

Linux `fork()` creates a child that is a near duplicate of the parent [1]. Parent and child run in separate memory spaces; at the fork instant contents match, but later writes in one do not change the other [1]. The child receives its own PID; the parent sees the child's PID as the return value, and the child sees `0` [1].

```c title="fork_demo.c"
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int g = 0;
int main(void) {
    pid_t p = fork();
    if (p == 0) {
        g = 42;
        printf("child pid=%d ppid=%d g=%d\n", (int)getpid(), (int)getppid(), g);
        return 0;
    }
    usleep(100000);
    printf("parent pid=%d child=%d g=%d\n", (int)getpid(), (int)p, g);
    return 0;
}
```

```bash
gcc -Wall -o fork_demo fork_demo.c
./fork_demo
```

Captured output (gcc 13.3.0, Linux x86_64):

```text
child pid=43013 ppid=43011 g=42
parent pid=43011 child=43013 g=0
```

The child sets global `g` to 42; the parent still reads `0`. PIDs differ; PPID links child to parent [2].

## Draw the fork moment

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 280" role="img" aria-label="fork splits one process into parent and child with separate memory after copy-on-write writes">
  <defs>
    <marker id="arrowProcessFork" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="280" rx="12" fill="#0b1f3a"/>
  <rect x="24" y="40" width="200" height="72" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="48" y="72" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">before: PID A</text>
  <text x="44" y="96" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">one address space</text>
  <path d="M236 76 H284" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowProcessFork)"/>
  <rect x="292" y="40" width="136" height="72" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="324" y="84" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">fork()</text>
  <path d="M440 60 H488" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowProcessFork)"/>
  <path d="M440 92 H488" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowProcessFork)"/>
  <rect x="496" y="24" width="200" height="56" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="508" y="48" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">parent PID A</text>
  <text x="508" y="68" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">return = child PID</text>
  <rect x="496" y="92" width="200" height="56" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="508" y="116" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">child PID B</text>
  <text x="508" y="136" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">return = 0</text>
  <rect x="24" y="184" width="672" height="72" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="36" y="216" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">After the child writes g=42, parent still sees g=0: copy-on-write split the page [1].</text>
  <text x="36" y="240" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Credentials and open files start as copies; later changes stay local unless shared on purpose [2].</text>
</svg>
</figure>

*Linux implements fork with copy-on-write: page tables split cheaply; physical copies happen when a page is written [1].*

## Create with fork, then often exec

Shells fork a child, then replace the child's program image with `execve` on the command you typed. The PID often stays the same across `exec`; the memory image becomes the new binary [1]. Pipelines fork multiple children. Job control uses process groups so signals can hit a foreground group together [2].

The executable on disk is a file. A process is that image loaded into memory with stacks, heap, open file descriptors, and environment. You can list processes with `ps` while the binary file sits unchanged in `/usr/bin`.

## Read the IDs the kernel cares about

From `credentials(7)` [2]:

1. PID: unique id for this process.
2. PPID: parent that created it via fork.
3. Process group and session: job-control groupings for shells and terminals.
4. Real and effective user and group: who owns the process and which permissions apply.

A child inherits copies of the parent's user and group IDs at fork [2]. Setuid binaries change effective UID when the kernel allows it; file permission checks use those credentials.

## Inspect the live tree with ps

```bash
ps -eo pid,ppid,stat,comm | head -6
```

Captured on this host (procps-style columns):

```text
    PID    PPID STAT COMMAND
      1       0 Ss   tini
      7       1 Sl   pod-daemon
    343       7 Ssl  node
    731       1 S    desktop-init.sh
    953       7 Ssl  cursor-agent-st
```

Column `PPID` is the parent PID from `credentials(7)` [2]. State letters describe running, sleeping, zombie, and stopped jobs. One supervisor spawning shells is normal in dev containers; production trees differ but the fields are the same [2].

On Linux, `/proc/<pid>/` exposes status files the kernel maintains. `ps` reads those nodes; it is not a single syscall named "list every process" [2]. When debugging, `cat /proc/<pid>/cmdline` shows the argv the kernel recorded.

## Signals, exit codes, and zombies

When a child exits first, the parent should `wait` (explicitly or via the shell) to reap its zombie entry [1]. A zombie is a finished process row waiting for the parent to read its status. Orphaned children get reparented to `init` or a subreaper.

Signals such as `SIGTERM` ask a process to exit; `SIGKILL` stops it without cleanup. Process groups let you signal a pipeline as a unit [2]. Shells surface exit codes from the last foreground command; background jobs need explicit `wait` or job control.

## Keep isolation in mind

Separate address spaces are why multi-process designs survive a crash in one sibling more often than shared-memory threads do. Tradeoff: inter-process communication (pipes, sockets, shared memory) costs more than a lock inside one process [1].

Containers and namespaces add another layer: processes can share a kernel but see different PID namespaces, mount trees, or network stacks ([what is a container](/blog/what-is-a-container)). The fork and credentials vocabulary still applies inside each namespace. Long-running network listeners are still processes; the service role is covered in [what is a server](/blog/what-is-a-server).

## Scheduling in one paragraph

The kernel scheduler picks which runnable process gets CPU time. Nice values and cgroups bias priority; this page does not spell cgroup v2 rules. For teaching, remember: many processes, one kernel, time sliced. Heavy CPU in one process can delay siblings unless isolated by limits.

## Wait status and exit codes

When a child exits before the parent calls `wait`, the child becomes a zombie until the parent reaps it [1]. The row stays in the process table with status bits but no memory image. Orphans adopt a new parent, often PID 1. Long lists of zombies point at a parent that never waits.

Shells surface exit codes from the last foreground command. Pipelines and background jobs need explicit `wait` or job control built into the shell. A non-zero exit is a process-level signal to the caller; it is not the same thing as a kernel oops.

## File descriptors across fork and exec

Children inherit copies of open file descriptors at fork unless you marked them close-on-exec [1]. That inheritance is how shells wire pipes between pipeline stages. It is also how a forgotten open log file stays open in a daemon after `exec`. When debugging "why is this file still locked," count processes and inspect `/proc/<pid>/fd`.

## Mistakes that blur the picture

Saying "the app crashed" when one worker died but supervisors respawned. Check how many PIDs listen on the port.

Expecting `fork` to copy every byte eagerly. Copy-on-write defers physical duplication until writes [1].

Treating threads as mini-processes with a separate heap by default. Threads in one process usually share the address space.

Using `kill -9` as the first debug step. You lose core dumps and graceful shutdown.

Forgetting that `exec` replaces the program but keeps the same PID and some open file descriptors unless marked close-on-exec [1].

Equating PID with port. Many processes share no network port; many containers can NAT the same host port to different PIDs.

Calling a container "not a process." Namespaces wrap processes; they do not replace the PID model ([what is a container](/blog/what-is-a-container)).

## What you have now

A sourced Linux process picture: PID, fork isolation measured on this host, and credentials from the man pages [1][2]. When someone says "the app," ask how many PIDs are involved. Long-running network listeners are still processes playing a server role ([what is a server](/blog/what-is-a-server)).

Browse the [Dev explainers topic](https://fullbytedeveloper.com/blog/topic/dev-explainers).

Send this to the friend who says the app when they mean twelve cooperating processes.

Image: Two dark matte cubes on a grid floor separated by a vertical translucent glass pane; left cube shows an orange diamond, right cube shows a teal button with a hanging metal ID tag, cyan arrows flowing between them.
https://fullbytedeveloper.com/media/what-is-a-process/what-is-a-process-venice.webp
Each process is its own tracked unit with an identity tag; the kernel keeps address spaces apart even when they talk.

## Sources

1. [Linux man-pages: fork(2), accessed 2026-12-03](https://man7.org/linux/man-pages/man2/fork.2.html)
2. [Linux man-pages: credentials(7), accessed 2026-12-03](https://man7.org/linux/man-pages/man7/credentials.7.html)
3. [Full Byte Developer: What is a container](https://fullbytedeveloper.com/blog/what-is-a-container)
4. [Full Byte Developer: What is a server](https://fullbytedeveloper.com/blog/what-is-a-server)
