Uninterruptable process in Windows(or Linux)?

前端 未结 3 705
时光说笑
时光说笑 2020-12-05 12:12

Is there any way to make a program that cannot be interrupted (an uninterrupted program)? By that, I mean a process that can\'t be terminated by any signal, kill comma

3条回答
  •  北海茫月
    2020-12-05 12:37

    Well, possibly one can write a program which doesn't respond for most signals like SIGQUIT, SIGHUP etc. - each kind of "kill" is actually a kind of signal sent to program by kernel, some signals means for the kernel that program is stuck and should be killed. Actually the only unkillable program is kernel itself, even init ( PID 1 ) can be "killed" with HUP ( which means reload ).

    Learn more about signal handling, starting with kill -l ( list signals ) command.

    Regarding Windows ( basing on "antivirus" tag ) - which actually applies to linux too - if you just need to run some antivirus user is unable to skip/close, it's permission problem, I mean program started by system, and non-administrative user without permission to kill it, won't be able to close/exit it anyway. I guess lameusers on Windows all over the world would start "solving" any problems they have by trying to close antivirus first, just if it would be possible :)

提交回复
热议问题