Identifying a Process Across Its Lifetime

An operating system can assign a running process an identifier so management and observation tools can refer to that instance.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace repeated launches
  2. Account for reuse
  3. Distinguish one process instance from a reused numeric ID
  4. Verify what control handle is still valid

Trace repeated launches

Running the same report command twice can create two process instances with different IDs and start times. Both originate from the same program. Source, programs, and processes explain that distinction.

Account for reuse

Process identifiers can be recycled after an instance ends. A long-lived observation can also record start time or use a stable handle where provided. Stable collection identifiers describe why an ID's expected scope matters.[1]

Distinguish one process instance from a reused numeric ID

A monitoring program records process ID 320 during one run. After that process exits, the operating system can assign 320 to another instance. A later observation with the same ID does not establish continuity. Combine PID with instance-specific context where the platform provides it. See parent and child exit.

Time one: PID 320 starts report job
Time two: that instance exits
Time three: an unrelated process receives PID 320
An old record still describes the first instance

Verify what control handle is still valid

A live handle can represent a stronger reference than a stale identifier under some APIs. When monitoring, check creation time or equivalent identity. Test successive short-lived jobs separately from one long-lived instance.

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩