linux - Using appropriate POSIX signals -


I am currently working on a project that has a daemon process that looks at the queue of tasks, Runs, and then collects information about those tasks In some cases, the daemon will have to "kill" the task if it will take a lot of time to run.

The explanation for SIGTERM is "endpoint", but it is not very informative. I would like to use the most suitable signal for this.

What is the most appropriate POSIX signal number to use for the process "Have you spent a lot of time so you have to stop now"?

If you are in control of child procedures, please do as much as you please, but SIGTERM is a self-documentary sign for this to politely ask a procedure to finish: how the process controls the signal and actually comes out (or can ignore the signal) clean before Safaiya can work.

The standard way to kill a process is to send SIGTERM first; So wait for it to end with grace period, say, five seconds (if the expiry time can take a very long time, e.g., due to large disk I / O) if grace period has expired , Then send a SIGKILL is a "hard" version of SIGTERM and it can not be ignored, but also an opportunity to clean the process cleanly after itself Does not leave To send SIGKILL should be considered an issue with the child's procedure and should be reported in this way.


Comments