In: Computer Science
Unix: Compare a sure kill with a regular kill command. When should you use a sure kill?
Both Kill and sure kill are used to kill a process . But the difference is seen in how the process which received the Kill or sure kill behaves.
Kill will generate a SIGTERM signal asking a process to kill itself gracefully i.e , free memory or take care of other child processes. Killing a process using kill will not have any side effects like unrelased memory because it was gracefully killed.
sure kill works similarly but it doesn't wait for the program to gracefully die. sure kill generates a SIGKILL signal which won't check the state of the process and kills the process immediately.
The major difference is SIGTERM(generated by Kill) can be ignored if the process is still to reach safe state(clear memory or similar activity) and the process may not be killed.Process cannot ignore the SIGKILL (generated by sure kill ) and will be killed immediately irrespective of the state they are in(this may some time cause some issues but the process is killed for sure).
When should you use a sure kill?
With the sure kill option, the kernel stops a process dead in its tracks giving it no time to execute a proper shutdown routine. Because this can result in data loss, this option should only be used when the process cannot otherwise be stopped.