Parent, Child, and Process Exit

A launcher and a launched process have distinct lifetimes. On many systems the launcher can use a wait operation to collect the child's exit result.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a command sequence
  2. Record failures separately
  3. Track the parent result and child completion separately
  4. Decide who collects or supervises termination

Trace a command sequence

A parent creates one report process and continues preparing another action. To use that report after it is complete, the parent waits or receives a completion indication. Waiting for a child gives the application behavior.

Record failures separately

A successful launch can lead to an unsuccessful child exit. On Unix-like systems termination information can also include a signal. Exit outcomes describe the portion documented by the command.[1]

Track the parent result and child completion separately

A parent can launch a child writer whose final success is observable later. Depending on the platform and supervision policy, exiting the parent may leave the child running or cause it to be terminated. Record which process returned each status. See waiting for a child.

Parent starts worker → child PID or handle recorded
Parent proceeds → child may still run
Child completes → supervisor obtains exit result under the operating-system contract

Decide who collects or supervises termination

Some systems require waiting to collect a child's exit status. A persistent worker should have a deliberate owner. Test a worker finishing normally and the parent leaving early.

References

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