Make the children create files containing their PID in some directory when they start and remove them when they exit. The problem with this approach is that children may exit without cleaning up its pid file and another unrelated process may take the same PID before you restart the main one (though most OSs try to avoid reusing pids as much as possible)
Capture signals on the parent and make it kill the children before exiting. The problem here is that not all signals can be trapped.
Monitor the PID of the parent process (getppid) on the children and abort when it becomes 1.