Linux has at least four levels of decreasing pleasantry: -1, -2, -15, and -9, aka HangUP, INTerrupt, TERMinate and KILL or “Please stop”, “Hey! Quit it!”, “Stop it! NOW!” and *loud gunshot*.
Sometimes processes will clean up after themselves and leave when asked nicely. Or sternly told off. Of course, if you don’t need or want that, load up your, uh, -9 shooter.
To be fair, even in Linux it’s really hard to kill a zombie process. You have to tell the parent to own up to their kid, and then kill the parent.
You can try asking a process to round up its dead children, but unlike the quit signals, the number varies by platform. For most Linux users it’s -17, but using the text version -CHLD is probably a better choice (unless you’re on a really old system that absolutely has to have a number, in which case check the local documentation.)
If it’s a well-behaved process, that can do away with the need to kill it. In other cases, there might be some kind of restart mechanism built in that can be called instead - assuming sending it a SIGCHLD doesn’t trigger that behaviour anyway.
Case in point, the Cinnamon DE has at least a couple of ways to restart it, and at least one of those gets rid of its zombie child processes. It’s fairly rare that I need to do that, and I haven’t tried sending it a -17. I might do at some point.
Why did I hear Viva La Dirt League in your
“Please stop”, “Hey! Quit it!”
I totally read that in Adam’s voice
I think I’ve seen a couple of their videos, and have no idea which of them Adam would be (can’t even call any faces to mind right now to be fair), so I’m pretty sure those phrases are in my head from elsewhere.
The “Please stop” is pretty generic, but got a lot of traction that time Hyperbole and a Half told a story involving it. “Hey! Quit it!” is probably Lisa or Bart from some episode of The Simpsons. “Stop it! NOW!” is probably something that was actually said to me at some point as a kid.
Never got shot though, so I must have started behaving at that point.
(For legal reasons, that last part is meant to be tongue-in-cheek. I am also using “for legal reasons” mostly humorously. Mostly.)
I mean, the process is not dying in either gif, so…
That is not how it works.
On Linux you can “ask” a program to close. That’s what happens when you press close. (Sigterm)
However, you can also use sigkill which really should not be used. That just tells the kernel to stop execution of that process. That won’t do things like remove resource locks. All it does is free up the memory and remove the process from the scheduler.
On Windows, there is no such thing as signals. There is a equivalent system however. If you want to gracefully close a program you can simulate the pushing of the close button. This is pretty much equivalent to a user pushing the close button. If you want kill a program you can use terminate process which tells the Windows kernel to stop running the process and to clean up memory. However, this doesn’t clear any resource locks and will also cause issues.
The big take away is that it is a really bad idea to kill applications instead of letting them terminate. This will create things like zombie processes and locked files no matter what system you are on.
Also just a little bit of Windows foo:
taskkill /IM process.exe
ask a process to terminate. Runs cleanup code and gracefully exits
taskkill /F /IM process.exe
kills the program. Exits uncleanly and will break things.
I have to use the terminate program thing SO OFTEN on my steamdeck. The browser just freezes.
What the duck Microsoft bullshit is this?
There is no concept of locked files in extfs, much less inside the kernel. Resource locks and unkillable processes is some windows bullshit that no sane operating system would touch with a ten foot pole.
You need resource locks to prevent race conditions. Linux has locks as well as every other OS.