On Sat, 15 Oct 2016, Andre Majorel wrote: > Or is pkill more than a wrapper around kill(pid, 15) and > kill(pid, 9) ?
pkill is quite less prone to killing the wrong process due to a race when you use it properly. In the general case one should avoid SIGKILL. Trying other signals that allow for orderly exit first is extremely recommended. SIGTERM being the typical one you'd want. There is also SIGQUIT, but too many programers get it wrong and trap SIGTERM for clean exit, but forget to actually trap SIGQUIT as well. > I used to have a user who had the bad habit of indiscriminately > going straight for SIGKILL. It was annoying. But not as much as > the fact that SIGKILL can't do anything about processes stuck in > "D" state. I really wish I knew a way to get rid of these. Processes are stuck in "D" state when the kernel is doing something on their behalf. State "D" is not really "waiting for IO" as I have seen people describe it, it would be more correct to call it "in the middle of a syscall". "waiting for IO" is just a subset of the reasons why a process can get stuck in "D" state... even if it is the most common one (AFAIK). -- Henrique Holschuh