# Processes

---

# Processes and Threads

_Peios / Using Peios / Processes_

> Distinguish execution, process identity, and managed workloads before inspecting or stopping work.

A process groups a program's memory and resources. Its threads execute the
work, sharing that process's address space and normally its open-resource
table. Threads still have their own execution state, and a thread can
impersonate a different principal while handling a request.

Use [Task Manager](/peios/using-peios/processes/task-manager.md) to inspect running
processes. Identify the command, owner, parent, and managing service or job;
those answer different questions.

## Identity across creation and program replacement

A PID identifies a process while it exists and can later be reused. The
Process GUID identifies that particular process across its lifetime and in
historical records. Neither identifies the principal acting through it.

A fork creates a child with a new PID and Process GUID. Private memory starts
from the parent's contents, while inherited descriptors can still refer to
the same open resources. The kernel's [token
lifecycle](/kernel/internals/kacs/tokens/token-lifecycle.md) defines identity
inheritance, including the distinction between primary and impersonation
tokens. Do not infer all inherited authority from a displayed account name.

Exec replaces the running program within a process. Its PID and Process GUID
remain, but the executable and its signature-derived protection can change.
A launcher commonly creates a child and then executes its program. Thread
creation shares more state instead of creating another independent process.
The exact creation flags and library contracts belong in runtime references.

A pidfd holds a particular process rather than whichever process later owns
a number. Programs should use that handle for stable targeting. From a shell,
recheck a PID's current command, owner, and workload before acting on an old
number.

## Workload relationships

| Relationship | What it identifies |
|---|---|
| Parent and child | Creation and responsibility for collecting exit results. |
| Service | A supervised definition whose processes can be restarted. |
| Submitted job | Work submitted to Peinit for management. |
| Process group | Processes targeted together by terminal job control. |
| Job-control session | Process groups and their possible controlling terminal. |
| Logon session | The authentication record referenced by identity tokens. |

A terminal pipeline and a submitted Peinit job are different uses of "job."
A job-control session need not have a terminal and is not a security identity.
With ordinary terminal settings, Ctrl-C and Ctrl-Z signal its foreground
process group; an explicit signal to one PID has a narrower target.

Userspace ancestry normally leads to Peinit, PID 1. Orphaned descendants can
be adopted by a nearer subreaper before PID 1 takes responsibility. Kernel
threads and idle tasks are separate system work; a process listing is not
only a list of applications started by people.

## Identity and program protection

The effective token describes who a thread acts as. The Process Security
Block describes the process: its GUID, program protection, mitigations, and
process security descriptor. Impersonation changes the effective identity,
not the calling program's protection.

Reading a limited process summary does not grant permission to inspect its
memory or stop it. A process's descriptor and Process Integrity Protection
can refuse those operations even when its row remains visible. See
[Inspecting Process Security](/peios/using-peios/identity-and-access/inspecting-process-security.md).
For managed work, ask the manager to perform the intended operation through
its own policy rather than repeatedly terminating a supervised PID.

---

# Interpreting Process State

_Peios / Using Peios / Processes_

> Distinguish waiting, suspension, and completed work before taking a process or workload action.

Inspect the process and its managing workload before deciding that a state
means failure. Sleeping is normal for a program waiting for work.

## Read the state

| State | Interpretation |
|---|---|
| Running or runnable | Executing or ready to be scheduled. |
| Sleeping | Waiting for an event; this alone does not indicate failure. |
| Stopped | Suspended, with work able to continue after a resume. |
| Traced | Stopped under a debugger's control. |
| Uninterruptible wait | Waiting on an operation that ordinary signals cannot interrupt. |
| Zombie | Execution has ended; an exit result remains to be collected. |

A persistent uninterruptible wait calls for inspecting the underlying I/O or
kernel wait, not repeatedly sending a stronger signal. A zombie cannot be
fixed by terminating it again. Inspect the parent that should collect its
result; accumulated unreaped children can consume process-table resources.

## Choose and verify an action

1. Identify the current process, its owner, parent, and service or job. Save
   work before requesting termination.
2. Choose the intended scope. Use `svctl stop NAME` for a service or
   `svctl job stop ID` for a submitted job. Ending only a service's main
   process can trigger its restart policy.
3. For one process, use Task Manager's **End process**, or `kill PID` to
   request orderly termination. Give the application time to finish.
4. Refresh process and workload state. Successful signal delivery does not
   establish that termination has completed.
5. If orderly termination fails and loss of unfinished work is acceptable,
   use the tool's force-termination operation. Recheck a numeric PID before
   using it again. Force termination skips application cleanup and cannot
   resolve an underlying uninterruptible wait.

`kill -STOP PID` and `kill -CONT PID` suspend and resume one process when
permitted. They do not finish its work or target an entire service. Pausing a
process can leave resources held and dependent work blocked.

Signal permissions depend on the operation, and process protection remains
relevant. Sharing an account or terminal is not a general bypass. The
[kill guide](/peios/using-peios/scripts-and-the-system/running-and-controlling-commands.md) and
[service controls](/peios/using-peios/services-and-jobs/controlling-services.md) describe the
owning interfaces.

## Exit and cleanup

The parent collects a child's result through a wait operation. That result
distinguishes ordinary exit from signal termination. Child-state notifications
prompt the parent to check; they are not a replacement for collecting results.
When a parent exits first, a subreaper or Peinit adopts remaining children.

Exit releases resources, but other owners can keep shared objects alive.
Token handles elsewhere and unreaped processes can keep a logon session
present after its visible work has ended. See [Inspecting and Ending
Sessions](/peios/using-peios/local-accounts/logonse.md) before interpreting a remaining
session as a still-running application.

---

# Inspecting Tasks and Sessions

_Peios / Using Peios / Processes_

> Find the right process and choose the scope of a stop operation.

Task Manager shows processes, resource use, jobs, and signed-in sessions.
Use it to identify what is running before deciding whether to end one
process, stop its service or job, or sign out a whole session.

## Before you start

You need Task Manager in a GXWI desktop. Access controls can hide process
details or sessions and can prevent a stop operation. Missing details are
not proof that the process has no owner or command.

## Inspect and act

1. Open **Task Manager** and select **Processes**. Use **Find** or sort by
   **CPU** or **Memory** to locate the process.
2. Select it and inspect its command, owner, parent, service or job, and
   session. **Group by** organizes the list by service or person.
3. Choose the smallest intended scope. **End process** targets one
   process; **Stop service** and **Stop job** ask peinit to stop their
   managed workload.
4. Review the confirmation. After an end request, a process still running
   after five seconds can offer **End it now**, which does not allow
   orderly completion.

## Check the result

Select **Refresh** or press **F5** and inspect the process and its managed
state. Ending a service's main process can trigger its restart policy.
Use **Stop service** when the intended result is a stopped service.
Task Manager retains a process handle for termination so a reused process
ID does not redirect that request to a different process.

## Sessions and visibility

**Signed in** lists visible logon sessions and their processes.
**Sign out** ends the selected session through authd; review carefully
when it is your own session. A refusal or a process that cannot be ended
can leave the session open. A service session is managed by its service.

The full kernel session list requires the corresponding access. Otherwise,
Task Manager lists the sessions it can infer from visible processes.
Protected processes can remain listed while their details and control are
unavailable, including to an administrator whose process lacks the needed
protection level. See `gxwi-task-manager(1)`.

---

# Performance Views

_Peios / Using Peios / Processes_

> Interpret Task Manager resource graphs and incomplete process details.

Task Manager's performance views describe recent activity on the machine.
They help locate a resource bottleneck, but a graph is not a persistent
monitoring history and does not explain a workload's cause on its own.

**Performance** groups processor, memory, disk, and network measurements.
Select an item to see its graph for the last two minutes. Data is sampled
every two seconds and discarded when the window closes.

Process CPU share is measured against the whole machine between samples,
so it is available from the second sample. **Each processor** shows
logical processors separately. Load averages describe runnable or waiting
threads over their reported intervals rather than the percentage shown by
the CPU graph.

**Available** memory estimates what programs can receive; cache is not all
unavailable memory. Disk graphs show active time and transfer rates.
Network graphs show transfer rates, not whether a remote service is
reachable. Use Network Manager for addresses, routes, and name resolution.

The process list and **Jobs** add context. A job is work submitted to
peinit outside a persistent service definition. Job visibility is checked
separately from process visibility. A process can therefore be shown
without details of the job it belongs to.

Do not infer a machine-wide absence from a filtered view. Task Manager
reports access restrictions and protected processes; compare those notes
with the list before drawing conclusions. Use Event Viewer when you need
recorded events or retained metrics rather than this window's samples.
