• Possibly linux
    link
    fedilink
    English
    25
    edit-2
    17 days ago

    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.

    • Mr. Satan
      link
      fedilink
      617 days ago

      From my experience, killing a process from task manager does free up any file locks held by the process. However, I wouldn’t consider it being graceful, any in-app cleanup is lost this way.

    • @TriflingToad
      link
      417 days ago

      I have to use the terminate program thing SO OFTEN on my steamdeck. The browser just freezes.

    • @steventhedev
      link
      -217 days ago

      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.

      • Possibly linux
        link
        fedilink
        English
        20
        edit-2
        17 days ago

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

        • @steventhedev
          link
          117 days 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.