Signals and Process Shutdown

A process can receive operating-system notifications used for control. Available signals and handling rules depend on the platform.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a handled stop
  2. Verify externally visible state
  3. Give ordinary shutdown a clear observable sequence
  4. Match the mechanism to the platform and supervisor

Trace a handled stop

A process that receives a catchable stop request may finish a coherent unit of work and release resources before exiting. An abrupt termination may prevent ordinary cleanup. Compare cooperative cancellation and finally cleanup.

Verify externally visible state

A launcher can collect the exit result and check whether complete output was committed. Record which expectations differ when the platform cannot run an application handler.[1]

Give ordinary shutdown a clear observable sequence

A long-running producer can handle a graceful shutdown request by stopping new work, finalizing an active record and releasing resources. An immediate forced stop may prevent these actions. Define a maximum wait and what partial output means. See buffered versus durable writes.

Request graceful stop
Producer stops accepting new work
Finish or cancel active work according to contract
Exit and observe status

Match the mechanism to the platform and supervisor

Signal names and delivery behavior vary by operating system and runtime. Test an idle program and one with an active operation. Verify that cleanup actually completes in the produced state or logs.

References

  1. The Open Group, POSIX Shell Command Language ↩