this post was submitted on 01 Sep 2024
366 points (95.5% liked)

linuxmemes

20741 readers
787 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] possiblylinux127@lemmy.zip 25 points 2 weeks ago* (last edited 2 weeks ago) (7 children)

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.

[–] steventhedev@lemmy.world -2 points 2 weeks ago (1 children)

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.

[–] possiblylinux127@lemmy.zip 20 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

You need resource locks to prevent race conditions. Linux has locks as well as every other OS.

[–] steventhedev@lemmy.world 1 points 2 weeks ago

Locks are only held during system calls. Process termination is handled on the system call boundary.

You're projecting windows kernel insanity where it doesn't belong.

load more comments (5 replies)