• Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    28
    arrow-down
    3
    ·
    edit-2
    3 months 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@monyet.cc
      link
      fedilink
      arrow-up
      6
      ·
      3 months 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.

    • steventhedev@lemmy.world
      link
      fedilink
      arrow-up
      6
      arrow-down
      8
      ·
      3 months 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@lemmy.zip
        link
        fedilink
        English
        arrow-up
        19
        ·
        edit-2
        3 months ago

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

        • steventhedev@lemmy.world
          link
          fedilink
          arrow-up
          5
          arrow-down
          4
          ·
          3 months 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.