Detecting process termination

In an embedded application, it's often important to detect if any process terminates prematurely and, if so, to handle it.

Handling it may involve something as simple as restarting the process or as complex as:

  1. Notifying other processes that they should put their systems into a safe state.
  2. Resetting the hardware.

This is complicated by the fact that some processes call procmgr_daemon(). Processes that call this function are referred to as daemons. The procmgr_daemon() function:

As a result of the above, their termination is hard to detect.

Another scenario is where a server process wants to know if any of its clients disappear so that it can clean up any resources it had set aside on their behalf.

Let's look at various ways of detecting process termination.